[infinispan-dev] Event handling behaviour

Pedro Ruivo pedro at infinispan.org
Fri Oct 11 05:30:32 EDT 2013


Hi guys.

Re: https://issues.jboss.org/browse/ISPN-2090

Summary: in tx caches, when @listener(sync = true), the callback is done 
by the same thread as the transaction. However, most of the events may 
not cause any problem, some of them are trigger when the transaction is 
in the state that cannot attach more commands.

So, I want to discuss here what would be the correct behaviour/logic for 
the callback (note this only affects tx caches) assuming that the 
callback invokes some operation (get/put/etc.) over the cache.

IMO, all the synchronous events should suspend the transaction. This 
way, we ensure that the operation is not attached to the transaction, 
the callback has the same behaviour if sync=true and sync=false and also 
with the events triggered in remote nodes (you will never read any 
non-committed data from a remote transaction neither attach the operation).

Mircea suggestion is the following:

I think the correct logic should be:

* if isPre() then the value should not be seen when reading the cache
* if !isPre() then value should be seen. Not totally sure, but the 
transaction as return by TransactionManager.getTransaction should not be 
visible (i.e. suspend it before notifying the listener), as this would 
result in different behavior on local/remote nodes that get notified.

Any other suggestion?

Cheers,
Pedro


More information about the infinispan-dev mailing list