Class TransactionManager
java.lang.Object
org.jpos.q2.QBeanSupport
org.jpos.transaction.TransactionManager
- All Implemented Interfaces:
Runnable, Configurable, QBean, QBeanSupportMBean, QPersist, TransactionConstants, TransactionManagerMBean, Loggeable, MetricsProvider
public class TransactionManager
extends QBeanSupport
implements Runnable, TransactionConstants, TransactionManagerMBean, Loggeable, MetricsProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Integerstatic final Stringstatic final Stringstatic final Integerprotected Map<String, List<TransactionParticipant>> static final Stringstatic final longstatic final longstatic final Integerstatic final Stringstatic final StringFields inherited from class QBeanSupport
cfg, log, scheduledThreadPoolExecutor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidabort(int session, long id, Serializable context, List<TransactionParticipant> members, boolean recover, LogEvent evt, Profiler prof) protected voidabort(TransactionParticipant p, long id, Serializable context) protected voidvoidprotected voidprotected voidprotected voidcommit(int session, long id, Serializable context, List<TransactionParticipant> members, boolean recover, LogEvent evt, Profiler prof) protected voidcommit(TransactionParticipant p, long id, Serializable context) protected voidprotected voidcreateParticipant(org.jdom2.Element e) voiddump(PrintStream ps, String indent) protected LogEventfreeze(Serializable context, LogEvent evt, Profiler prof) This method gives the opportunity to decorate a LogEvent right before it gets logged.intstatic <T extends Serializable>
TlonggetHead()static LonggetId()longprotected Stringintintprotected List<TransactionParticipant> getParticipants(long id) protected List<TransactionParticipant> getParticipants(String groupName) static Serializableprotected intThis method returns the number of sessions that can be started at this point in timegetSpace()longgetTail()getTPS()floatlongintprotected List<TransactionParticipant> initGroup(org.jdom2.Element e) protected voidinitParticipants(org.jdom2.Element config) voidprotected voidinitStatusListeners(org.jdom2.Element config) protected booleanThis method returns true if current session should stop working on more messagesprotected intprepare(int session, long id, Serializable context, List<TransactionParticipant> members, Iterator<TransactionParticipant> iter, boolean abort, LogEvent evt, Profiler prof, Chronometer chronometer) protected intprepare(TransactionParticipant p, long id, Serializable context) protected intprepareForAbort(TransactionParticipant p, long id, Serializable context) protected voidpurge(long id, boolean full) voidpush(Serializable context) voidqueue(Serializable context) protected voidrecover()protected voidrecover(long id) voidvoidresetTPS()voidrun()voidprotected voidprotected voidsnapshot(long id, Serializable context) protected voidsnapshot(long id, Serializable context, Integer status) voidvoidprotected booleantailDone()Methods inherited from class QBeanSupport
addAttr, close, createElement, destroy, destroyService, getAttrs, getAttrs, getConfiguration, getDump, getFactory, getLoader, getLoaderURLS, getLog, getLogger, getName, getPersist, getProperties, getProperty, getRealm, getScheduledThreadPoolExecutor, getServer, getState, getStateAsString, init, isModified, running, setAttr, setLogger, setModified, setName, setPersist, setProperty, setRealm, setServer, setState, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface QBeanSupportMBean
getDump, getLoader, getLoaderURLS, getLogger, getName, getRealm, getServer, setLogger, setName, setPersist, setRealm, setServerMethods inherited from interface QPersist
getPersist, isModified
-
Field Details
-
CONTEXT
-
STATE
-
GROUPS
-
RETRY_QUEUE
- See Also:
-
PREPARING
-
COMMITTING
-
DONE
-
DEFAULT_GROUP
- See Also:
-
MAX_PARTICIPANTS
- See Also:
-
MAX_WAIT
- See Also:
-
groups
-
-
Constructor Details
-
TransactionManager
public TransactionManager()
-
-
Method Details
-
initService
- Overrides:
initServicein classQBeanSupport- Throws:
ConfigurationException
-
startService
- Overrides:
startServicein classQBeanSupport- Throws:
Exception
-
stopService
- Overrides:
stopServicein classQBeanSupport
-
queue
-
push
-
getQueueName
-
getSpace
-
getInputSpace
-
getPersistentSpace
-
run
-
getTail
- Specified by:
getTailin interfaceTransactionManagerMBean
-
getHead
- Specified by:
getHeadin interfaceTransactionManagerMBean
-
getInTransit
-
setConfiguration
- Specified by:
setConfigurationin interfaceConfigurable- Overrides:
setConfigurationin classQBeanSupport- Parameters:
cfg- Configuration object- Throws:
ConfigurationException
-
addListener
-
removeListener
-
getTPS
-
getTPSAsString
- Specified by:
getTPSAsStringin interfaceTransactionManagerMBean
-
getTPSAvg
- Specified by:
getTPSAvgin interfaceTransactionManagerMBean
-
getTPSPeak
- Specified by:
getTPSPeakin interfaceTransactionManagerMBean
-
getTPSPeakWhen
- Specified by:
getTPSPeakWhenin interfaceTransactionManagerMBean
-
getTPSElapsed
- Specified by:
getTPSElapsedin interfaceTransactionManagerMBean
-
resetTPS
- Specified by:
resetTPSin interfaceTransactionManagerMBean
-
getMetrics
- Specified by:
getMetricsin interfaceMetricsProvider
-
dump
-
commit
protected void commit(int session, long id, Serializable context, List<TransactionParticipant> members, boolean recover, LogEvent evt, Profiler prof) -
abort
protected void abort(int session, long id, Serializable context, List<TransactionParticipant> members, boolean recover, LogEvent evt, Profiler prof) -
prepareForAbort
-
prepare
-
commit
-
abort
-
prepare
protected int prepare(int session, long id, Serializable context, List<TransactionParticipant> members, Iterator<TransactionParticipant> iter, boolean abort, LogEvent evt, Profiler prof, Chronometer chronometer) -
getParticipants
-
getParticipants
-
initStatusListeners
- Throws:
ConfigurationException
-
initParticipants
- Throws:
ConfigurationException
-
initGroup
- Throws:
ConfigurationException
-
createParticipant
- Throws:
ConfigurationException
-
getOutstandingTransactions
- Specified by:
getOutstandingTransactionsin interfaceTransactionManagerMBean
-
getKey
-
commitOff
-
commitOn
-
checkTail
-
tailDone
-
snapshot
-
snapshot
-
setState
-
addGroup
-
purge
-
recover
-
recover
-
checkRetryTask
-
freeze
This method gives the opportunity to decorate a LogEvent right before it gets logged. When overriding it, unless you know what you're doing, you should return a FrozenLogEvent in order to prevent concurrency issues.- Parameters:
context- current Contextevt- current LogEventprof- profiler (may be null)- Returns:
- FrozenLogEvent
-
getSessionsToStandUp
This method returns the number of sessions that can be started at this point in time- Returns:
- number of sessions
-
isSessionToStandDown
This method returns true if current session should stop working on more messages- Returns:
-
getActiveSessions
- Specified by:
getActiveSessionsin interfaceTransactionManagerMBean
-
getMaxSessions
- Specified by:
getMaxSessionsin interfaceTransactionManagerMBean
-
getSerializable
-
getContext
-
getId
-