-
1. Re: CacheListener is (unduly) notified of rollbacked operati
galder.zamarreno Nov 30, 2009 3:33 AM (in response to chtimi2)Modifications are only rolledback when there're transactions and for such notifications, there's @TransactionCompleted and its TransactionCompletedEvent that contains:
/** * @return if <tt>true</tt>, the transaction completed by committing successfully. If <tt>false</tt>, the transaction * completed with a rollback. */ boolean isSuccessful();
-
2. Re: CacheListener is (unduly) notified of rollbacked operati
chtimi2 Dec 2, 2009 10:07 AM (in response to chtimi2)Do you mean something like i should accumulate events, clear the accumulating list on TransactionCompletedEvent, and re-fire the accumulated events on TransactionCompletedEvent if isSuccessful is true?
I have seen this workaround mentionned in the PojoCacheListener javadoc, but i don't understand why JBPC doesn't already do this by himself.
I can't think of a use case where you would need to be notified of rolled back events. -
3. Re: CacheListener is (unduly) notified of rollbacked operati
chtimi2 Dec 4, 2009 5:20 AM (in response to chtimi2)The CacheListener is a local observer: it sees changes to the local copy of the cache.
If a transaction is started on the "master" node (master for a given interaction, otherwise nodes need not be symmetric), and it is rolled back, changes are not replicated to the slave nodes.
Thus on slave nodes, the CacheListener is not notified of any change on rollback.
So the only problem is that the master node's CacheListener IS notified even in case of rollback.
So you don't need the workaround if, on the master node, you don't need the notification. -
4. Re: CacheListener is (unduly) notified of rollbacked operati
galder.zamarreno Jan 11, 2010 3:00 AM (in response to chtimi2)I'm not sure what your problem is with the master node. If you implement @TransactionRegistered you can know when a transaction started and any @NodeModified events you receive between when @TransactionRegistered was called and when @TransactionCompleted is received, you know these are not final unless you receive TransactionCompletedEvent.isSuccessful=true, otherwise you should be able to discard them.