This discussion is archived
1 Reply Latest reply: Mar 10, 2013 5:08 PM by robvarga RSS

Proper way of accessing backing map from entry processor

RyszardStyczynski Newbie
Currently Being Moderated
Hi!

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?

Thanks,
Ryszard
  • 1. Re: Proper way of accessing backing map from entry processor
    robvarga Oracle ACE
    Currently Being Moderated
    Ryszard Styczynski wrote:
    Hi!

    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?

    Thanks,
    Ryszard
    The correct way of accessing backing maps of caches in the same service as the entry-processor is running inside is:

    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).

    Restrictions:

    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.

    Best regards,

    Robert

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points