com.atomikos.icatch
Interface TransactionService

All Known Implementing Classes:
TransactionServiceImp

public interface TransactionService

This internal interface is the base interface for creating transactions. It also acts as a container for existing transactions. Each transaction manager has a transaction service to take care of recovery, and for creating transactions and subtransactions.


Method Summary
 void addTSListener(TSListener listener)
          Adds a listener to the transaction service.
 CompositeTransaction createCompositeTransaction(long timeout)
          Starts a new transaction.
 CompositeCoordinator getCompositeCoordinator(String root)
          Gets a composite coordinator for the given root.
 CompositeTransaction getCompositeTransaction(String tid)
          Gets the composite transaction with the given tid.
 Participant getParticipant(String root)
          Gets a participant handle for the given root.
 RecoveryCoordinator getSuperiorRecoveryCoordinator(String root)
          Gets the superior recovery coordinator for a given root.
 void init(Properties properties)
          Initializes the TM, and recovers.
 CompositeTransaction recreateCompositeTransaction(Propagation context, boolean orphancheck, boolean heur_commit)
          Recreates a composite transaction based on an imported context.
 void removeTSListener(TSListener listener)
          Removes a listener from the transaction service.
 void shutdown(boolean force)
          Shuts down the server in a clean way.
 

Method Detail

addTSListener

void addTSListener(TSListener listener)
Adds a listener to the transaction service. This method should be called before init! If called afterwards, only the init (false) callback will happen in the listener.

Parameters:
listener - The listener.

removeTSListener

void removeTSListener(TSListener listener)
Removes a listener from the transaction service.

Parameters:
listener - The listener.

getCompositeTransaction

CompositeTransaction getCompositeTransaction(String tid)
Gets the composite transaction with the given tid.

Parameters:
tid - The transaction identifier.
Returns:
CompositeTransaction The transaction, or null if none.

init

void init(Properties properties)
          throws SysException
Initializes the TM, and recovers. Should be first method called.

Parameters:
properties - The properties used to initialize the system.
Throws:
SysException

createCompositeTransaction

CompositeTransaction createCompositeTransaction(long timeout)
                                                throws SysException
Starts a new transaction.

Returns:
CompositeTransaction The new instance.
Throws:
SysException

recreateCompositeTransaction

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

Parameters:
context - The propagation context. Any interposition actions should already have taken place, so that the propagation is ready to be used by the local transaction service.
orphancheck - If true, real composite transactions are done. If false, unchecked behavior applies.
heur_commit - True for heuristic commit, false for heuristic rollback.
timeout - Time in millis after which heur_commit is applied.
Returns:
CompositeTransaction The recreated local instance.
Throws:
SysException

shutdown

void shutdown(boolean force)
              throws SysException,
                     IllegalStateException
Shuts 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:
IllegalStateException - If active transactions exist, and not force.
SysException

getParticipant

Participant getParticipant(String root)
                           throws SysException
Gets a participant handle for the given root. This method is for subordinated coordinators: in those cases, a participant role is fulfilled w.r.t. parent coordinators.

Parameters:
root - The root identifier.
Returns:
Participant The participant instance.
Throws:
SysException - On failure, or if the given root is not known.

getCompositeCoordinator

CompositeCoordinator getCompositeCoordinator(String root)
                                             throws SysException
Gets a composite coordinator for the given root. Needed to allow TM to swap out instances after heuristic termination. If a commit, abort, forget or replay request comes in, this method should be called first to revive the instance.

Parameters:
root - The root in case.
Returns:
The composite coordinator for this root.
Throws:
SysException

getSuperiorRecoveryCoordinator

RecoveryCoordinator getSuperiorRecoveryCoordinator(String root)
Gets the superior recovery coordinator for a given root. Needed for imported transactions only.

Parameters:
root - The root ID
Returns:
The recovery coordinator, or null if the root does not exist or if the root was not imported.


Copyright © 2012. All Rights Reserved.