Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.geronimo.transaction.manager
Class TransactionImpl  view TransactionImpl download TransactionImpl.java

java.lang.Object
  extended byorg.apache.geronimo.transaction.manager.TransactionImpl
All Implemented Interfaces:
javax.transaction.Transaction
Direct Known Subclasses:
RecoveryImpl.ExternalTransaction

public class TransactionImpl
extends java.lang.Object
implements javax.transaction.Transaction

Basic local transaction with support for multiple resources.

Version:
$Rev: 128441 $ $Date: 2005-01-27 14:56:21 -0800 (Thu, 27 Jan 2005) $

Nested Class Summary
private static class TransactionImpl.TransactionBranch
           
 
Field Summary
private  java.util.IdentityHashMap activeXaResources
           
private static org.apache.commons.logging.Log log
           
private  java.lang.Object logMark
           
private  java.util.LinkedList resourceManagers
           
private  int status
           
private  java.util.IdentityHashMap suspendedXaResources
           
private  java.util.List syncList
           
private  long timeout
           
private  TransactionLog txnLog
           
private  javax.transaction.xa.Xid xid
           
private  XidFactory xidFactory
           
 
Constructor Summary
(package private) TransactionImpl(XidFactory xidFactory, TransactionLog txnLog, long transactionTimeoutMilliseconds)
           
  TransactionImpl(javax.transaction.xa.Xid xid, TransactionLog txLog)
           
(package private) TransactionImpl(javax.transaction.xa.Xid xid, XidFactory xidFactory, TransactionLog txnLog, long transactionTimeoutMilliseconds)
           
 
Method Summary
 TransactionImpl.TransactionBranch addBranchXid(javax.transaction.xa.XAResource xaRes, javax.transaction.xa.Xid branchId)
           
private  void afterCompletion()
           
private  void beforeCompletion()
           
private  void beforePrepare()
           
 void commit()
           
private  void commitResources(java.util.List rms)
           
 boolean delistResource(javax.transaction.xa.XAResource xaRes, int flag)
           
private  void endResources()
           
private  void endResources(java.util.IdentityHashMap resourceMap)
           
 boolean enlistResource(javax.transaction.xa.XAResource xaRes)
           
 boolean equals(java.lang.Object obj)
          Determine whether this Object is semantically equal to another Object.
private static java.lang.String getStateString(int status)
           
 int getStatus()
           
private  boolean internalPrepare()
           
(package private)  int prepare()
           
(package private)  void preparedCommit()
           
 void registerSynchronization(javax.transaction.Synchronization synch)
           
 void rollback()
           
private  void rollbackResources(java.util.List rms)
           
 void setRollbackOnly()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

xidFactory

private final XidFactory xidFactory

xid

private final javax.transaction.xa.Xid xid

txnLog

private final TransactionLog txnLog

timeout

private final long timeout

syncList

private final java.util.List syncList

resourceManagers

private final java.util.LinkedList resourceManagers

activeXaResources

private final java.util.IdentityHashMap activeXaResources

suspendedXaResources

private final java.util.IdentityHashMap suspendedXaResources

status

private int status

logMark

private java.lang.Object logMark
Constructor Detail

TransactionImpl

TransactionImpl(XidFactory xidFactory,
                TransactionLog txnLog,
                long transactionTimeoutMilliseconds)
          throws javax.transaction.SystemException

TransactionImpl

TransactionImpl(javax.transaction.xa.Xid xid,
                XidFactory xidFactory,
                TransactionLog txnLog,
                long transactionTimeoutMilliseconds)
          throws javax.transaction.SystemException

TransactionImpl

public TransactionImpl(javax.transaction.xa.Xid xid,
                       TransactionLog txLog)
Method Detail

getStatus

public int getStatus()
              throws javax.transaction.SystemException
Specified by:
getStatus in interface javax.transaction.Transaction

setRollbackOnly

public void setRollbackOnly()
                     throws java.lang.IllegalStateException,
                            javax.transaction.SystemException
Specified by:
setRollbackOnly in interface javax.transaction.Transaction

registerSynchronization

public void registerSynchronization(javax.transaction.Synchronization synch)
                             throws java.lang.IllegalStateException,
                                    javax.transaction.RollbackException,
                                    javax.transaction.SystemException
Specified by:
registerSynchronization in interface javax.transaction.Transaction

enlistResource

public boolean enlistResource(javax.transaction.xa.XAResource xaRes)
                       throws java.lang.IllegalStateException,
                              javax.transaction.RollbackException,
                              javax.transaction.SystemException
Specified by:
enlistResource in interface javax.transaction.Transaction

delistResource

public boolean delistResource(javax.transaction.xa.XAResource xaRes,
                              int flag)
                       throws java.lang.IllegalStateException,
                              javax.transaction.SystemException
Specified by:
delistResource in interface javax.transaction.Transaction

commit

public void commit()
            throws javax.transaction.HeuristicMixedException,
                   javax.transaction.HeuristicRollbackException,
                   javax.transaction.RollbackException,
                   java.lang.SecurityException,
                   javax.transaction.SystemException
Specified by:
commit in interface javax.transaction.Transaction

prepare

int prepare()
      throws javax.transaction.SystemException,
             javax.transaction.RollbackException

preparedCommit

void preparedCommit()
              throws javax.transaction.SystemException

beforePrepare

private void beforePrepare()

internalPrepare

private boolean internalPrepare()
                         throws javax.transaction.SystemException

rollback

public void rollback()
              throws java.lang.IllegalStateException,
                     javax.transaction.SystemException
Specified by:
rollback in interface javax.transaction.Transaction

beforeCompletion

private void beforeCompletion()

afterCompletion

private void afterCompletion()

endResources

private void endResources()

endResources

private void endResources(java.util.IdentityHashMap resourceMap)

rollbackResources

private void rollbackResources(java.util.List rms)
                        throws javax.transaction.SystemException

commitResources

private void commitResources(java.util.List rms)
                      throws javax.transaction.SystemException

getStateString

private static java.lang.String getStateString(int status)

equals

public boolean equals(java.lang.Object obj)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


addBranchXid

public TransactionImpl.TransactionBranch addBranchXid(javax.transaction.xa.XAResource xaRes,
                                                      javax.transaction.xa.Xid branchId)