com.atomikos.icatch.imp
Class BaseTransactionManager

java.lang.Object
  extended by com.atomikos.icatch.imp.BaseTransactionManager
All Implemented Interfaces:
CompositeTransactionManager, SubTxAwareParticipant, Serializable

public class BaseTransactionManager
extends Object
implements CompositeTransactionManager, SubTxAwareParticipant

Abstract TM class, to be extended for different communication layers. For instance, transacted RMI could be one extension, JTS another one.

See Also:
Serialized Form

Constructor Summary
protected BaseTransactionManager()
           
 
Method Summary
 void committed(CompositeTransaction tx)
          Called if a tx is ended successfully.
 CompositeTransaction createCompositeTransaction(long timeout)
           
 CompositeTransaction getCompositeTransaction()
           
 CompositeTransaction getCompositeTransaction(String tid)
           
 Participant getParticipant(String root)
          Get the participant for the given root.
 void init(TransactionServiceImp service, Properties properties)
          Initialize the TM.
protected  CompositeTransaction recreateCompositeTransaction(Propagation context, boolean orphancheck, boolean heur_commit)
          Recreate a composite transaction based on an imported context.
 void resume(CompositeTransaction ct)
           
 void rolledback(CompositeTransaction tx)
          Called if a tx is ended with failure.
 void shutdown(boolean force)
          Shut down the server in a clean way.
protected  void startlistening(CompositeTransaction transaction)
           
 CompositeTransaction suspend()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseTransactionManager

protected BaseTransactionManager()
Method Detail

init

public void init(TransactionServiceImp service,
                 Properties properties)
          throws SysException
Initialize the TM.

Parameters:
service - The tx service to use. As part of this method, the service will also be initialized.
properties - The init properties.
Throws:
SysException

getParticipant

public Participant getParticipant(String root)
Get the participant for the given root. Needed for recovery of JCA inbound transactions.

Parameters:
root -
Returns:
The participant.

committed

public void committed(CompositeTransaction tx)
Called if a tx is ended successfully. In order to remove the tx from the mapping.

Specified by:
committed in interface SubTxAwareParticipant
See Also:
SubTxAwareParticipant

rolledback

public void rolledback(CompositeTransaction tx)
Called if a tx is ended with failure. In order to remove tx from mapping.

Specified by:
rolledback in interface SubTxAwareParticipant
See Also:
SubTxAwareParticipant

getCompositeTransaction

public CompositeTransaction getCompositeTransaction()
                                             throws SysException
Specified by:
getCompositeTransaction in interface CompositeTransactionManager
Throws:
SysException
See Also:
CompositeTransactionManager

getCompositeTransaction

public CompositeTransaction getCompositeTransaction(String tid)
                                             throws SysException
Specified by:
getCompositeTransaction in interface CompositeTransactionManager
Throws:
SysException
See Also:
CompositeTransactionManager

recreateCompositeTransaction

protected CompositeTransaction recreateCompositeTransaction(Propagation context,
                                                            boolean orphancheck,
                                                            boolean heur_commit)
                                                     throws SysException
Recreate a composite transaction based on an imported context. Needed by the application's communication layer.

Parameters:
context - The propagationcontext.
orphancheck - If true, real composite txs are done. If false, OTS like behavior applies.
heur_commit - True for heuristic commit, false for heuristic rollback.
Returns:
CompositeTransaction The recreated local instance.
Throws:
SysException - Failure.

suspend

public CompositeTransaction suspend()
                             throws SysException
Specified by:
suspend in interface CompositeTransactionManager
Throws:
SysException
See Also:
CompositeTransactionManager

resume

public void resume(CompositeTransaction ct)
            throws IllegalStateException,
                   SysException
Specified by:
resume in interface CompositeTransactionManager
Throws:
IllegalStateException
SysException
See Also:
CompositeTransactionManager

shutdown

public void shutdown(boolean force)
              throws SysException,
                     IllegalStateException
Shut down the server in a clean way.

Parameters:
force - If true, shutdown will not wait for possibly indoubt txs to finish. Calling shutdown with force being true implies that shutdown will not fail, but there may be remaining timer threads that stay asleep until there timeouts expire. Such remaining active transactions will NOT be able to finish, because the recovery manager will be shutdown by that time. New transactions will not be allowed.
Throws:
SysException - For unexpected errors.
IllegalStateException - If active txs exist, and not force.

startlistening

protected void startlistening(CompositeTransaction transaction)
                       throws SysException
Throws:
SysException

createCompositeTransaction

public CompositeTransaction createCompositeTransaction(long timeout)
                                                throws SysException
Specified by:
createCompositeTransaction in interface CompositeTransactionManager
Throws:
SysException
See Also:
CompositeTransactionManager


Copyright © 2014. All Rights Reserved.