Reputation: 153
I am getting "Cache has been closed" exception when accessing Ignite Cache for querying. What I'm doing is simply,
CacheConfiguration cfg = new CacheConfiguration();
cacheConfiguration.setCacheMode(CacheMode.REPLICATED);
cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); cacheConfiguration.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
IgniteCache cache = ignite.getOrCreateCache(cfg);
After initializing this, in other place in my code I am calling cache.get("key")
; But it's throwing exception.
Cache variable is member of some class's object. Why can't the cache be kept open till it is closed manually.
I AM NOT CLOSING IT ANYWHERE
Upvotes: 0
Views: 216
Reputation: 1265
Usually it happens when client is disconnected, servers go down, or client rejoins with new ID since you're not calling .close()
or .destory()
anywhere in your code.
Upvotes: 1