com.atomikos.icatch
Interface TransactionService

All Known Subinterfaces:
TransactionServiceProvider

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(TransactionServicePlugin listener)
          Adds a listener to the transaction service.
 CompositeTransaction createCompositeTransaction(long timeout)
          Starts a new transaction.
 CompositeCoordinator getCompositeCoordinator(java.lang.String root)
          Gets a composite coordinator for the given root.
 CompositeTransaction getCompositeTransaction(java.lang.String tid)
          Gets the composite transaction with the given tid.
 Participant getParticipant(java.lang.String root)
          Gets a participant handle for the given root.
 CompositeTransaction recreateCompositeTransaction(Propagation context, boolean orphancheck, boolean heur_commit)
          Recreates a composite transaction based on an imported context.
 void removeTSListener(TransactionServicePlugin 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(TransactionServicePlugin 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(TransactionServicePlugin listener)
Removes a listener from the transaction service.

Parameters:
listener - The listener.

getCompositeTransaction

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

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

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,
                     java.lang.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:
java.lang.IllegalStateException - If active transactions exist, and not force.
SysException

getParticipant

Participant getParticipant(java.lang.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(java.lang.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


Copyright © 2016. All Rights Reserved.