Asynchronous marshalling example
For example, with async marshalling turned on: Â App calls: cache.put("car", "bmw"); cache.remove("car"); Â Other nodes could receive these operations in this order: cache.remove("car"); cache.put("car", "bmw"); Â The end result is clearly different which is often not desirable. So, if your application makes multiple modifications on the same key, you should either: turned off asynchronous marshalling, or set element's maxThreads to 1. The first modification only applies to a particular named cache, whereas the second option affects all named caches in configuration file that are configured with async marshalling. It's worth noting though that having this type of executor configured with a single thread would defeat its purpose adding unnecessary contention point. It'd be better to simply switch off async marshalling. Â On the contrary, if your application only ever makes one modification per key/value pair and there's no happens-before relationship between them, then async marshalling is a very valid optimization that can increase performance of your application without data consistency risks. Â If you have async marshalling turned on and see exceptions related to java.util.concurrent.RejectedExecutionException, as explained in thetechnical faq page, you should also consider switching off async marshalling. Â Back in Infinispan 4.0, when element was used, this property was set to true by default. However due to reordering risks mentioned earlier, the default has changed to false from Infinispan 4.1 onwards.