-
1. Re: How do I get rollback to occur with remote cache access?
belaban Mar 26, 2005 6:26 PM (in response to jlmcknight)Maybe the remote cache was not enrolled in the TX, did you make sure that this was the case ?
Also, try the following: call Transaction.setRollbackOnly() on top of throwing the exception and see whether the data on the remote cache is not removed when the TX rolls back.
If this is still the case, can you create a simple test case and submit it in the form of a JIRA bug report (attach the test case). This would be really helpful to us ! -
2. Re: How do I get rollback to occur with remote cache access?
jlmcknight Mar 28, 2005 5:29 PM (in response to jlmcknight)Thanks for the reply.
I think I discovered for myself that the scenario I tried where there was a session bean running on the jboss instance with the cache wouldn't work because the JBoss transaction manager doesn't extend transactions across JVM's. However, from your reply, I assume it should work if the cache is looked up and accessed directly from the other instance.
I apologize for my ignorance, but could you give me a little more guidance with your suggestions? I'm no expert on transactions, I've mostly just used container managed transactions without any direct manipulation.
What exactly do I need to do to verify whether the cache was enrolled in the transaction?
Also, I tried a sessionContext.setRollbackOnly() in my session bean, but that made no difference, the cache still didn't roll back. I was also going to try setting that on the transaction at the cache level, in case that's what you meant, so I tried to get the Transaction Manager for the cache using getTransactionManager() on the TreeCacheMBean instance, but that resulted in this error...
Caused by: java.io.NotSerializableException: org.jboss.tm.TxManager
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at java.rmi.MarshalledObject.(MarshalledObject.java:92)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:364)
.... -
3. Re: How do I get rollback to occur with remote cache access?
belaban Mar 29, 2005 1:54 AM (in response to jlmcknight)I suggest debug the remote TreeCache MBean, set a breakpoint into TreeCache.put():
public Object put(Fqn fqn, Object key, Object value) throws CacheException {
GlobalTransaction tx=getCurrentTransaction();
MethodCall m=new MethodCall(putKeyValMethodLocal, new Object[]{tx, fqn, key, value, Boolean.TRUE});
return invokeMethod(m);
}
Step into getCurrentTransaction(), you'll see that if getLocalTransaction() is null, then you don't have a TX.