This content has been marked as final. Show 1 reply
Ryszard Styczynski wrote:The correct way of accessing backing maps of caches in the same service as the entry-processor is running inside is:
I was blocked today on nasty exception during accessing backing map from entry processor. Sometimes backing map is returned as "null". I'm doing something completely wrong in such "null" situation. Looking for help...
Can you share example of your working code doing such access? How are you dealing with "null" backing map?
1. Cast the entry passed to the EntryProcessor to BinaryEntry.
2. You can get the backing map manager context of the cache service by BinaryEntry.getBackingMapManagerContext().
3. From the BackingMapManagerContext you can get the backing map context of other caches in the same service by BackingMapManagerContext.getBackingMapContext(String).
4. You can get BinaryEntry instances for entries in the backing map context by getBackingMapEntry(Object). The object you pass to this method must be a key of an entry in internal format (obtained from another entry with getBinaryKey() or calculated by BackingMapManager.getKeyToInternalConverter.convert(Object keyAsObject).
Accessing caches outside of the service or entries in different partitions from which the entry-processor is originally running on is not safe and can lead to nasty situations (or return null).
Getting the backing map from the backing map manager context and mutating it is not safe and should not be used.