Patches item #537220, was opened at 2002-03-30 16:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=537220&group_id=22866

Category: JBossCMP
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Rettig (mrettig)
Assigned to: Nobody/Anonymous (nobody)
Summary: No rollback for SessionSynchronization

Initial Comment:
The session synchronization interface allows sessions 
to be notified of the begin and end of a transaction. 

Here are the specifications from the J2EE docs..

****J2EE Specifications******
The beforeCompletion method notifies a session Bean 
instance that a transaction is about to be committed. 
The instance can use this method, for example, to 
write any cached data to a database. 
This method executes in the proper transaction 
context. 

Note: The instance may still cause the container to 
rollback the transaction by invoking the 
setRollbackOnly() method on the instance context, or 
by throwing an exception.

*********END J2EE Specs*************

Unfortunately, JBoss does not notify the transaction 
of the exception, so the error is simply logged and 
ignored. 

Here is the offending code.
........
package org.jboss.ejb.plugins;
.......
public class StatefulSessionInstanceInterceptor
.............
private class InstanceSynchronization implements 
Synchronization
............
      public void beforeCompletion()
      {
         // lock the context the transaction is being 
commited (no need for sync)
         ctx.lock();
                        
         if (notifySession)
         {
             try {
                 beforeCompletion.invoke
(ctx.getInstance(), new Object[0]);
             } catch (Exception e) {
***************THIS IS THE PROBLEM******************
                 log.error("failed to invoke 
beforeCompletion", e);             }
         }
      }

This should be changed to a RuntimeException with the 
actual exception nested inside and thrown to the 
calling transaction so it can roll back. 

Furthermore, the exception needs to be handled and 
thrown to the client so the client can process it. 

I've written a testcase to reproduce the problem. If 
needed I can give this to you.

I've comfirmed the problem is still present in the 
latest nightly source distribution (as of 3/30/02), 
and also in the 2.4 stable release. 

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=537220&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to