com.atomikos.icatch.jta
Class RemoteClientUserTransaction

java.lang.Object
  extended by com.atomikos.icatch.jta.RemoteClientUserTransaction
All Implemented Interfaces:
Externalizable, Serializable, Referenceable, UserTransaction

public final class RemoteClientUserTransaction
extends Object
implements UserTransaction, Externalizable, Referenceable

An implementation of a (remote) client's user transaction. When client-demarcated transactions are enabled, this is the kind of UserTransaction you get by calling getUserTransaction() on the UserTransactionService. Client applications can use the result to control transaction demarcation, and even pass their instance to other VMs so that those can share the same transaction context. The server-side applications can use the toString() method to obtain the transaction identifier of the transaction represented by an instance. This way, an incoming call from a client that demarcates its own transactions only has to ship the UserTransaction to the server (or to other clients) to identify what transaction it is in.
NOTE: remote clients that use instances of this class can do transaction demarcation, but they can not do nested transactions!
NOTE: instances that are meant to be bound in JNDI should be bound without any transaction context (i.e., without calling begin() first).

See Also:
Serialized Form

Constructor Summary
RemoteClientUserTransaction()
          No-argument constructor, as required by Externalizable interface.
RemoteClientUserTransaction(String name, String initialContextFactory, String providerUrl)
          Preferred constructor.
 
Method Summary
 void begin()
           
 void commit()
           
 Reference getReference()
           
 int getStatus()
           
 void readExternal(ObjectInput in)
           
 void rollback()
           
 void setRollbackOnly()
           
 void setTransactionTimeout(int seconds)
           
 String toString()
          Overrides the default behaviour, to allow retrieving the corresponding transaction at the server side.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteClientUserTransaction

public RemoteClientUserTransaction()
No-argument constructor, as required by Externalizable interface.


RemoteClientUserTransaction

public RemoteClientUserTransaction(String name,
                                   String initialContextFactory,
                                   String providerUrl)
Preferred constructor.

Parameters:
name - The unique name of the UserTransactionServer.
initialContextFactory - The initial context factory of the server JNDI context.
providerUrl - The provider URL of the server JNDI context.
Method Detail

begin

public void begin()
           throws NotSupportedException,
                  SystemException
Specified by:
begin in interface UserTransaction
Throws:
NotSupportedException
SystemException
See Also:
UserTransaction

commit

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

rollback

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

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException,
                            SystemException
Specified by:
setRollbackOnly in interface UserTransaction
Throws:
IllegalStateException
SystemException
See Also:
UserTransaction

getStatus

public int getStatus()
              throws SystemException
Specified by:
getStatus in interface UserTransaction
Throws:
SystemException
See Also:
UserTransaction

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
Specified by:
setTransactionTimeout in interface UserTransaction
Throws:
SystemException
See Also:
UserTransaction

toString

public String toString()
Overrides the default behaviour, to allow retrieving the corresponding transaction at the server side.

Overrides:
toString in class Object
Returns:
String The transaction ID (tid) of the transaction for which the thread is executing. Null if no transaction.

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException
See Also:
Referenceable

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException
See Also:
Externalizable

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException
See Also:
Externalizable


Copyright © 2011. All Rights Reserved.