|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atomikos.icatch.imp.TransactionServiceImp
public class TransactionServiceImp
General implementation of Transaction Service.
Constructor Summary | |
---|---|
TransactionServiceImp(String name,
StateRecoveryManager recoverymanager,
UniqueIdMgr tidmgr,
Console console,
long maxtimeout,
boolean checkorphans,
int maxActives,
boolean single_threaded_2pc)
Create a new instance, with orphan checking set. |
|
TransactionServiceImp(String name,
StateRecoveryManager recoverymanager,
UniqueIdMgr tidmgr,
Console console,
long maxtimeout,
int maxActives,
boolean single_threaded_2pc)
Create a new instance, with orphan checking set. |
Method Summary | |
---|---|
void |
addTSListener(TSListener listener)
Adds a listener to the transaction service. |
void |
committed(CompositeTransaction tx)
Called if a tx is ended successfully. |
CompositeTransaction |
createCompositeTransaction(long timeout)
Start a new transaction. |
protected String |
createTid()
Create a new tid. |
void |
entered(FSMEnterEvent event)
Called when the FSM has entered a new state. |
void |
finalize()
|
CompositeCoordinator |
getCompositeCoordinator(String root)
Gets a composite coordinator for the given root. |
CompositeTransaction |
getCompositeTransaction(String tid)
Get the composite transaction with the given tid. |
protected Object |
getLatch(String root)
Get an object to lock for the given root. |
LogControl |
getLogControl()
Get a LogControl for the service. |
String |
getName()
Get the transaction service's unique name. |
Participant |
getParticipant(String root)
Get a participant for the given root. |
protected StateRecoveryManager |
getStateRecoveryManager()
Get the state recovery manager. |
RecoveryCoordinator |
getSuperiorRecoveryCoordinator(String root)
Gets the superior recovery coordinator for a given root. |
void |
init(Properties properties)
Initialize TM, and recover. |
void |
recover()
Ask the TM to recover. |
protected void |
recoverCoordinators()
Recover instances from a given recovery manager. |
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 |
rolledback(CompositeTransaction tx)
Called if a tx is ended with failure. |
void |
shutdown(boolean force)
Shut down the server in a clean way. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransactionServiceImp(String name, StateRecoveryManager recoverymanager, UniqueIdMgr tidmgr, Console console, long maxtimeout, int maxActives, boolean single_threaded_2pc)
name
- The unique name of this TM.recoverymanager
- The recovery manager to use.tidmgr
- The String manager to use.console
- The console to use. Null if none.maxtimeout
- The max timeout for new or imported txs.maxActives
- The max number of active txs, or negative if unlimited.single_threaded_2pc
- Whether 2PC commit should happen in the same thread that started the tx.public TransactionServiceImp(String name, StateRecoveryManager recoverymanager, UniqueIdMgr tidmgr, Console console, long maxtimeout, boolean checkorphans, int maxActives, boolean single_threaded_2pc)
name
- The unique name of this TM.recoverymanager
- The recovery manager to use.tidmgr
- The String manager to use.console
- The console to use. Null if none.maxtimeout
- The max timeout for new or imported txs.checkorphans
- If false, orphan checking is disabledmaxActives
- The max number of active txs, or negative if unlimited.
even for creation requests that ask for checks. This
mode may be needed for being compatible with certain
configurations that do not support orphan detection.single_threaded_2pc
- Whether 2PC commit should happen in the same thread that started the tx.Method Detail |
---|
protected Object getLatch(String root)
protected String createTid() throws SysException
SysException
protected StateRecoveryManager getStateRecoveryManager()
protected void recoverCoordinators() throws SysException
SysException
- For unexpected failure.public String getName()
RecoveryService
getName
in interface RecoveryService
public void recover()
RecoveryService
recover
in interface RecoveryService
RecoveryService
public LogControl getLogControl()
public CompositeCoordinator getCompositeCoordinator(String root) throws SysException
TransactionService
getCompositeCoordinator
in interface TransactionService
root
- The root in case.
SysException
- If not found.TransactionService
public void addTSListener(TSListener listener) throws IllegalStateException
TransactionService
addTSListener
in interface TransactionService
listener
- The listener.
IllegalStateException
TransactionService
public void removeTSListener(TSListener listener)
TransactionService
removeTSListener
in interface TransactionService
listener
- The listener.TransactionService
public void init(Properties properties) throws SysException
TransactionService
init
in interface TransactionService
properties
- The properties used to
initialize the system.
SysException
- Unexpected failure.TransactionService
public Participant getParticipant(String root) throws SysException
TransactionService
getParticipant
in interface TransactionService
root
- The root identifier.
SysException
- On failure, or if the given root is not known.TransactionService
public void entered(FSMEnterEvent event)
FSMEnterListener
entered
in interface FSMEnterListener
FSMEnterListener.
public void committed(CompositeTransaction tx)
committed
in interface SubTxAwareParticipant
tx
- The composite transaction that has terminated
locally at its node.SubTxAwareParticipant
public void rolledback(CompositeTransaction tx)
rolledback
in interface SubTxAwareParticipant
SubTxAwareParticipant
public CompositeTransaction getCompositeTransaction(String tid)
TransactionService
getCompositeTransaction
in interface TransactionService
tid
- The transaction identifier.
TransactionService
public CompositeTransaction recreateCompositeTransaction(Propagation context, boolean orphancheck, boolean heur_commit) throws SysException
TransactionService
recreateCompositeTransaction
in interface TransactionService
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.
SysException
- Failure.TransactionService
public void shutdown(boolean force) throws SysException, IllegalStateException
TransactionService
shutdown
in interface TransactionService
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.
SysException
- For unexpected errors.
IllegalStateException
- If active txs exist, and not force.TransactionService
public void finalize() throws Throwable
finalize
in class Object
Throwable
public RecoveryCoordinator getSuperiorRecoveryCoordinator(String root)
TransactionService
getSuperiorRecoveryCoordinator
in interface TransactionService
root
- The root ID
TransactionService.getSuperiorRecoveryCoordinator(java.lang.String)
public CompositeTransaction createCompositeTransaction(long timeout) throws SysException
TransactionService
createCompositeTransaction
in interface TransactionService
SysException
- Unexpected error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |