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 exising 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)
          Start a new transaction.
 CompositeCoordinator getCompositeCoordinator(String root)
          Gets a composite coordinator for the given root.
 CompositeTransaction getCompositeTransaction(String tid)
          Get the composite transaction with the given tid.
 Participant getParticipant(String root)
          Get a participant for the given root.
 RecoveryCoordinator getSuperiorRecoveryCoordinator(String root)
          Gets the superior recovery coordinator for a given root.
 void init(Properties properties)
          Initialize TM, and recover.
 CompositeTransaction recreateCompositeTransaction(Propagation context, boolean orphancheck, boolean heur_commit)
          Recreate a composite transaction based on an imported context.
 void removeTSListener(TSListener listener)
          Removes a listener from the transaction service.
 void shutdown(boolean force)
          Shut 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)
Get 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
Initialize TM, and recover. Should be first method called.

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

createCompositeTransaction

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

Returns:
CompositeTransaction The new instance.
Throws:
SysException - Unexpected error.

recreateCompositeTransaction

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. 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 txs are done. If false, OTS like behavior applies.
heur_commit - True for heuristic commit, false for heuristic rollback.
timeout - Time in ms after which heur_commit is applied.
Returns:
CompositeTransaction The recreated local instance.
Throws:
SysException - Failure.

shutdown

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.

getParticipant

Participant getParticipant(String root)
                           throws SysException
Get a participant for the given root. This method is for subordinator 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:
CoordinatorImp The composite coordinator for root.
Throws:
SysException - If not found.

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 © 2011. All Rights Reserved.