Removing an entry from IMap within an EntryProcessor

847 views
Skip to first unread message

facun...@gmail.com

unread,
Dec 2, 2014, 5:01:02 AM12/2/14
to haze...@googlegroups.com
I am using a distributed map to track the state of transactions (set of operations) executed on a Cassandra.

If the transaction fails and remains uncompleted, we want to trigger a clean up over those transactions which where not completed successfully. To do so IMap.executeOnEntries is used.

The EntryProcessor does the clean up and then it is supposed to remove the entries which has successfully clean up.

Is there an already provided mechanism for doing this?

Many thanks!!!!

Ali Gurbuz

unread,
Dec 3, 2014, 5:16:07 AM12/3/14
to haze...@googlegroups.com
if you set the value of entry to null, it means you are removing it.

static class MyEntryProcessor extends AbstractEntryProcessor {
@Override
public Object process(Map.Entry entry) {
Object oldValue = entry.getValue();
entry.setValue(null);
return oldValue; //return old value if needed
}
}


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/fee96819-cdd7-4b74-9993-6f8f4c9bbb6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Ali Gurbuz
Solutions Architect

Mahir İz Cad. No:35, Altunizade, İstanbul
a...@hazelcast.com 
+90 507 857 7815
@aligurbuz

facun...@gmail.com

unread,
Dec 3, 2014, 8:31:32 AM12/3/14
to haze...@googlegroups.com
Many thanks!

facun...@gmail.com

unread,
Dec 3, 2014, 9:12:20 AM12/3/14
to haze...@googlegroups.com, facun...@gmail.com

I couldn't find it in the java docs here but i will give it a try
http://docs.hazelcast.org/docs/3.3/javadoc/com/hazelcast/map/EntryProcessor.html
Reply all
Reply to author
Forward
0 new messages