1 Reply Latest reply: Dec 17, 2013 4:30 AM by user123799 RSS

    Order in which triggers on entries obtained via BackingMapContext.getBackingMapEntry()

    user123799

      Hi All,

       

      I'm currently working with Coherence 3.7.1. I've been refactoring some entry processors and want to make use of the getBackingMapEntry call to take advance of the partition level transactions they provide. Unfortunately, I've not been able to do so as the order in which the triggers are run against the entries is not the order in which the entries were obtained/modified.  I'm assuming that the sandbox is just a set of entries, rather than any kind of ordered collection.  Does anyone know if  this also the case in v12 or if there are any plans to change this to a more deterministic order?

       

      Thanks,

       

      Andy

        • 1. Re: Order in which triggers on entries obtained via BackingMapContext.getBackingMapEntry()
          user123799

          Given the lack of a response I'm assuming I've either not explained myself clearly enough, or Rob and JK are off eating too many mince pies

           

          So, let's try give more info...

           

          Say I have an silly entry processor, which when fired against an integer key sets the value of some other entries in the cache too using BackingMapContext.getBackingMapEntry():

           

          public class MyFirstEntryProcessor implements InvocableMap.EntryProcessor {

               ...

           

            @Override

              public Object process(InvocableMap.Entry e) {

                    BinaryEntry binaryEntry = (BinaryEntry) e;    

                    BackingMapContext mapContext = binaryEntry.getBackingMapContext();

           

                    for (int i = 0; i != 10; ++i) {

                         Binary key = convertKeyToInternal(((Integer)binaryEntry.getKey()) + i);

                         BinaryEntry entry = (BinaryEntry) mapContext.getBackingMapEntry(key);

                         entry.updateBinaryValue(convertValueToInternal(i));

                    }         

              }

           

              ...

          }

           

          Say I also have a trigger on the cache in question, and this trigger logs out the key of the entry.  Now, if I populate the cache with some appropriate data and fire this entry processor against key '0',  I'd hope to see an output something like

           

          Trigger fired against key 1

          Trigger fired against key 2

          Trigger fired against key 3

          Trigger fired against key 4

          Trigger fired against key 5

          ... etc

           

          However, what I see is :

           

          Trigger fired against key 5

          Trigger fired against key 8

          Trigger fired against key 1

          Trigger fired against key 3

          ... etc

           

          i.e. the order in which the trigger on the modified entries is not the same order in which the entries were obtained and modified by the EP.  In situations where the triggers can themselves modify other entries in the backingmap, the order can (and in my case is) be important.   Is there any plans to support such ordering?

           

          Also, getBackingMapEntry is currently only available within the context of an EP call - is there any plan to extend this to cover trigger calls?  I'd like to make use of partition level transactions when mutating other entries from within a trigger.

           

          Many thanks (and a happy Christmas),

           

          Andy