[jboss-dev-forums] [Design of JBossCache] - Re: [JBCACHE-1470] Option to disable cache event generation
galder.zamarreno@jboss.com
do-not-reply at jboss.com
Fri Jan 30 07:36:06 EST 2009
Yesterday while testing this, I realised that Transaction Completed notifications will always happen regardless of whether I set the correct option override before the tx commit and with NotifierImpl.notifyTransactionCompleted() modified accordingly.
The root cause here is that in LocalSynchronizationHandler.beforeCompletioninvocation() invocation context options are subsitiuted with the ones from the transaction context:
// set any transaction wide options as current for this thread, caching original options that would then be reset
| originalOptions = ctx.getOptionOverrides();
| transactionalOptions = transactionContext.getOption();
| ctx.setOptionOverrides(transactionalOptions);
So, when NotifierImpl.notifyTransactionCompleted() is called, no matter what overrides I set before the tx.commit() call, they won't be used.
The quick'n'easy fix here would be doing something like this:
// set any transaction wide options as current for this thread, caching original options that would then be reset
| originalOptions = ctx.getOptionOverrides();
| transactionalOptions = transactionContext.getOption();
| transactionalOptions.setSuppressEventNotification(originalOptions.isSuppressEventNotification());
| ctx.setOptionOverrides(transactionalOptions);
But I'm not 100% sure about this.
Another interesting point here related to the following parallel thread going on about Options API (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=149495) is that if we allow supression of transaction related notifications, then we'd need to keep to thread local use for this particular Option as we can't change the TM API.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205874#4205874
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205874
More information about the jboss-dev-forums
mailing list