org.objectweb.jonas_tm
Class SubCoordinator

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--org.objectweb.common.RemoteObject
                          |
                          +--org.objectweb.jonas_tm.SubCoordinator
All Implemented Interfaces:
java.rmi.Remote, Resource, java.io.Serializable

public class SubCoordinator
extends RemoteObject
implements Resource

This object is the local coordinator. It may be registered as sub-coordinator in case of distributed transaction, so it must be callable remotely and implement Resource

See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.objectweb.jonas_tm.Resource
VOTE_COMMIT, VOTE_READONLY, VOTE_ROLLBACK
 
Method Summary
 boolean addResource(javax.transaction.xa.XAResource xares)
          add a XAResource to the list
 void addSynchronization(javax.transaction.Synchronization synchro)
          add a Synchronization to the list
 void commit_one_phase()
          commit 1 phase.
 void commit()
          phase 2 of the 2PC.
 void forget()
          forget heuristics about this transaction.
 int getStatus()
          return the status of this transaction
 int prepare()
          phase 1 of the 2PC.
 void rollback()
          rollback transaction
 void setRollbackOnly()
          set the transaction "rollback only"
 java.lang.String stringStatus()
          return a string form of the transaction status (debugging)
 
Methods inherited from class org.objectweb.common.RemoteObject
getPort, setPort
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

prepare

public int prepare()
            throws java.rmi.RemoteException
phase 1 of the 2PC.
Specified by:
prepare in interface Resource
Returns:
int vote commit, rollback, or readonly.

rollback

public void rollback()
              throws java.rmi.RemoteException
rollback transaction
Specified by:
rollback in interface Resource

commit

public void commit()
            throws java.rmi.RemoteException
phase 2 of the 2PC.
Specified by:
commit in interface Resource

commit_one_phase

public void commit_one_phase()
                      throws java.rmi.RemoteException
commit 1 phase. Called either from JTM (distributed transaction) or from Transaction.commit (local transaction).
Specified by:
commit_one_phase in interface Resource

forget

public void forget()
            throws java.rmi.RemoteException
forget heuristics about this transaction.
Specified by:
forget in interface Resource

addSynchronization

public void addSynchronization(javax.transaction.Synchronization synchro)
                        throws javax.transaction.RollbackException,
                               java.lang.IllegalStateException
add a Synchronization to the list
Parameters:
synchro - The javax.transaction.Synchronization object for the transaction associated with the target object
Throws:
javax.transaction.RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
java.lang.IllegalStateException - Thrown if the transaction in the target object is in prepared state or the transaction is inactive.

addResource

public boolean addResource(javax.transaction.xa.XAResource xares)
                    throws javax.transaction.RollbackException,
                           java.lang.IllegalStateException
add a XAResource to the list
Parameters:
the - XAResource to register
Returns:
true if this datasource was already known
Throws:
javax.transaction.RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
java.lang.IllegalStateException - Thrown if the transaction in the target object is in prepared state or the transaction is inactive.

getStatus

public int getStatus()
return the status of this transaction

setRollbackOnly

public void setRollbackOnly()
set the transaction "rollback only"

stringStatus

public java.lang.String stringStatus()
return a string form of the transaction status (debugging)