org.slim3.transaction.jta
Class TransactionImpl

java.lang.Object
  extended by org.slim3.transaction.jta.TransactionImpl
All Implemented Interfaces:
Transaction

public class TransactionImpl
extends Object
implements Transaction

An implementation class for Transaction.

Since:
3.0
Author:
higa

Field Summary
protected  int bid
          The internal branch identifier.
protected static AtomicInteger gidGenerator
          The internal global identifier generator.
protected static Log log
          The log.
protected  List<XAResourceContext> resourceContexts
          The list for XAResource.
protected  int status
          The transaction status.
protected  List<Synchronization> synchronizations
          The list for Synchronization.
protected  XidImpl xid
          The transaction identifier.
 
Constructor Summary
TransactionImpl()
          Constructor.
 
Method Summary
protected  void afterCompletion()
          This method is called after the transaction is committed or rolled back.
protected  void beforeCompletion()
          This method is called prior to the start of the transaction completion process.
 void begin()
          Begins transaction.
 void commit()
           
protected  void commitResources()
           
 boolean delistResource(XAResource resource, int flag)
           
protected  void endResources(int flags)
          Ends resources.
 boolean enlistResource(XAResource resource)
           
 boolean equals(Object obj)
           
 int getStatus()
           
 Xid getXid()
          Returns the transaction identifier.
 int hashCode()
           
 void registerSynchronization(Synchronization sync)
           
 void resume()
          Resumes transaction.
 void rollback()
           
protected  void rollbackResources()
           
 void setRollbackOnly()
           
 void suspend()
          Suspends transaction
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static Log log
The log.


gidGenerator

protected static AtomicInteger gidGenerator
The internal global identifier generator.


xid

protected XidImpl xid
The transaction identifier.


status

protected int status
The transaction status.


resourceContexts

protected List<XAResourceContext> resourceContexts
The list for XAResource.


synchronizations

protected List<Synchronization> synchronizations
The list for Synchronization.


bid

protected int bid
The internal branch identifier.

Constructor Detail

TransactionImpl

public TransactionImpl()
Constructor.

Method Detail

begin

public void begin()
Begins transaction.


enlistResource

public boolean enlistResource(XAResource resource)
                       throws RollbackException,
                              IllegalStateException,
                              SystemException
Specified by:
enlistResource in interface Transaction
Throws:
RollbackException
IllegalStateException
SystemException

delistResource

public boolean delistResource(XAResource resource,
                              int flag)
                       throws IllegalStateException,
                              SystemException
Specified by:
delistResource in interface Transaction
Throws:
IllegalStateException
SystemException

suspend

public void suspend()
             throws IllegalStateException,
                    SystemException
Suspends transaction

Throws:
IllegalStateException - if status is not active
SystemException - if XAException is encountered

resume

public void resume()
            throws SystemException
Resumes transaction.

Throws:
SystemException - if XAException is encountered

commit

public void commit()
            throws RollbackException,
                   HeuristicMixedException,
                   HeuristicRollbackException,
                   SecurityException,
                   IllegalStateException,
                   SystemException
Specified by:
commit in interface Transaction
Throws:
RollbackException
HeuristicMixedException
HeuristicRollbackException
SecurityException
IllegalStateException
SystemException

rollback

public void rollback()
              throws IllegalStateException,
                     SecurityException,
                     SystemException
Specified by:
rollback in interface Transaction
Throws:
IllegalStateException
SecurityException
SystemException

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException,
                            SystemException
Specified by:
setRollbackOnly in interface Transaction
Throws:
IllegalStateException
SystemException

getStatus

public int getStatus()
Specified by:
getStatus in interface Transaction

registerSynchronization

public void registerSynchronization(Synchronization sync)
                             throws RollbackException,
                                    IllegalStateException,
                                    SystemException
Specified by:
registerSynchronization in interface Transaction
Throws:
RollbackException
IllegalStateException
SystemException

getXid

public Xid getXid()
Returns the transaction identifier.

Returns:
the transaction identifier

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

endResources

protected void endResources(int flags)
Ends resources.

Parameters:
flags - the flags

commitResources

protected void commitResources()

rollbackResources

protected void rollbackResources()

beforeCompletion

protected void beforeCompletion()
This method is called prior to the start of the transaction completion process.


afterCompletion

protected void afterCompletion()
This method is called after the transaction is committed or rolled back.



Copyright © 2008-2009 The Slim3 project. All Rights Reserved.