You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@apache.org on 2001/01/17 07:51:27 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/common ServiceImpl.java

remm        01/01/16 22:51:27

  Modified:    src/share/org/apache/slide/common ServiceImpl.java
  Log:
  - Do comparisons on the transaction ids (instead of the xids instances, which
    are different for each branches.
  
  Revision  Changes    Path
  1.6       +33 -10    jakarta-slide/src/share/org/apache/slide/common/ServiceImpl.java
  
  Index: ServiceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/ServiceImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServiceImpl.java	2001/01/10 18:49:34	1.5
  +++ ServiceImpl.java	2001/01/17 06:51:27	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/ServiceImpl.java,v 1.5 2001/01/10 18:49:34 remm Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/01/10 18:49:34 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/ServiceImpl.java,v 1.6 2001/01/17 06:51:27 remm Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/01/17 06:51:27 $
    *
    * ====================================================================
    *
  @@ -75,7 +75,7 @@
    * Slide Service default implementation.
    * 
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public abstract class ServiceImpl implements Service {
       
  @@ -116,6 +116,12 @@
           SlideTransactionManager.DEFAULT_TRANSACTION_TIMEOUT;
       
       
  +    /**
  +     * Rollback only.
  +     */
  +    protected boolean rollbackOnly = false;
  +    
  +    
       // -------------------------------------------------------- Service Methods
       
       
  @@ -247,14 +253,21 @@
               throw new XAException(XAException.XAER_NOTA);
   	if (xid == null)
   	    throw new XAException(XAException.XAER_INVAL);
  -        if (currentContext != xid)
  +        if (currentContext.getGlobalTransactionId() 
  +            != xid.getGlobalTransactionId())
               throw new XAException(XAException.XAER_PROTO);
           
           if (!onePhase && status != TX_PREPARED)
               throw new XAException(XAException.XAER_PROTO);
           
  +        if (rollbackOnly) {
  +            rollback(xid);
  +            throw new XAException(XAException.XA_RBROLLBACK);
  +        }
  +        
           currentContext = null;
           status = TX_IDLE;
  +        rollbackOnly = false;
           
       }
       
  @@ -285,12 +298,16 @@
               throw new XAException(XAException.XAER_NOTA);
   	if (xid == null)
   	    throw new XAException(XAException.XAER_INVAL);
  -        if (currentContext != xid)
  +        if (currentContext.getGlobalTransactionId() 
  +            != xid.getGlobalTransactionId())
               throw new XAException(XAException.XAER_PROTO);
           
           if (flags == XAResource.TMSUSPEND)
               status = TX_SUSPENDED;
           
  +        if (flags == XAResource.TMFAIL)
  +            rollbackOnly = true;
  +        
       }
       
       
  @@ -309,11 +326,13 @@
               throw new XAException(XAException.XAER_NOTA);
   	if (xid == null)
   	    throw new XAException(XAException.XAER_INVAL);
  -        if (currentContext != xid)
  +        if (currentContext.getGlobalTransactionId() 
  +            != xid.getGlobalTransactionId())
               throw new XAException(XAException.XAER_PROTO);
           
           currentContext = null;
           status = TX_IDLE;
  +        rollbackOnly = false;
           
       }
       
  @@ -379,7 +398,8 @@
               throw new XAException(XAException.XAER_NOTA);
   	if (xid == null)
   	    throw new XAException(XAException.XAER_INVAL);
  -        if (currentContext != xid)
  +        if (currentContext.getGlobalTransactionId() 
  +            != xid.getGlobalTransactionId())
               throw new XAException(XAException.XAER_PROTO);
           
           status = TX_PREPARED;
  @@ -431,7 +451,8 @@
               throw new XAException(XAException.XAER_NOTA);
   	if (xid == null)
   	    throw new XAException(XAException.XAER_INVAL);
  -        if (currentContext != xid)
  +        if (currentContext.getGlobalTransactionId() 
  +            != xid.getGlobalTransactionId())
               throw new XAException(XAException.XAER_PROTO);
           
           status = TX_IDLE;
  @@ -477,7 +498,9 @@
           
   	if (xid == null)
   	    throw new XAException(XAException.XAER_INVAL);
  -        if ((currentContext != null) || (currentContext != xid))
  +        if ( (currentContext != null) || 
  +             (currentContext.getGlobalTransactionId() 
  +              != xid.getGlobalTransactionId()) )
               throw new XAException(XAException.XAER_OUTSIDE);
           
           switch (flags) {