Class Switch
java.lang.Object
org.jpos.transaction.participant.Switch
- All Implemented Interfaces:
Configurable, GroupSelector, TransactionConstants, TransactionParticipant
GroupSelector that picks the next participant group based on the
transaction name stored in the context (default key ContextConstants.TXNNAME).-
Field Summary
Fields inherited from interface TransactionConstants
ABORTED, FAIL, NO_JOIN, PAUSE, PREPARED, READONLY, RETRYModifier and TypeFieldDescriptionstatic final intTransaction has been aborted.static final intShortcut for a read-only, non-joining abort (READONLY | NO_JOIN).static final intThis participant does not join the transactionstatic final intTransaction is paused.static final intTransaction has been prepared successfully.static final intContext has not been modified (no need to persist a snapshot)static final intTransaction should be retried. -
Constructor Summary
ConstructorsConstructorDescriptionSwitch()Creates the selector; configuration is supplied viasetConfiguration(Configuration). -
Method Summary
Modifier and TypeMethodDescriptionintprepare(long id, Serializable o) Called by TransactionManager in preparation for a transactionselect(long id, Serializable ser) Selects the transaction group to execute.voidConfigures this object with the suppliedConfiguration.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TransactionParticipant
abort, commitModifier and TypeMethodDescriptiondefault voidabort(long id, Serializable context) Called by TransactionManager upon transaction commit.default voidcommit(long id, Serializable context) Called by TransactionManager upon transaction commit.
-
Constructor Details
-
Switch
public Switch()Creates the selector; configuration is supplied viasetConfiguration(Configuration).
-
-
Method Details
-
select
Description copied from interface:GroupSelectorSelects the transaction group to execute.- Specified by:
selectin interfaceGroupSelector- Parameters:
id- transaction idser- transaction context- Returns:
- group name or null for no-action
-
prepare
Description copied from interface:TransactionParticipantCalled by TransactionManager in preparation for a transaction- Specified by:
preparein interfaceTransactionParticipant- Parameters:
id- the Transaction identifiero- transaction context- Returns:
- PREPARED or ABORTED (| NO_JOIN | READONLY)
-
setConfiguration
Description copied from interface:ConfigurableConfigures this object with the suppliedConfiguration.- Specified by:
setConfigurationin interfaceConfigurable- Parameters:
cfg- Configuration object
-