java - Are ehcache putAll Operations Thread Safe and Atomic? -


the documentation says ehcache thread safe. far understand if thread a updates cache updates visible other threads.

but wonder if putall operation thread safe , atomic? say, want update cache invoking putall , passing map actual values. say, want value cache while being updated. receive old value or wait till cache updated , receive new value?

an operation atomic when operation can performed entirely or not performed @ all. according interface ehcache putall operation not atomic.

this method throw nullpointerexception if null element or null key encountered in collection, , partial completion may result (as of elements may have been put).

regarding if ehcache threadsafe or not. ehcache designed threadsafe. take example cache implementation.

cache threadsafe.

but beware threadsafe not mean synchronized. what's difference?

threadsafe means class can used multiple threads without errors or problems.

synchronized means 1 or more methods can used 1 thread @ same time.

what mean in case of putall , lets get call. both methods threadsafe not synchronized.

therefore can't sure if thread calls putall , thread b calls get afterwards putall executed before get.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

python 3.5 - Pyqtgraph string in x tick -