org.jpos.transaction
Class TransactionManager

java.lang.Object
  extended by org.jpos.q2.QBeanSupport
      extended by org.jpos.transaction.TransactionManager
All Implemented Interfaces:
Runnable, Configurable, QBean, QBeanSupportMBean, QPersist, TransactionConstants, TransactionManagerMBean

public class TransactionManager
extends QBeanSupport
implements Runnable, TransactionConstants, TransactionManagerMBean


Nested Class Summary
 class TransactionManager.PausedMonitor
           
 class TransactionManager.RetryTask
           
 
Field Summary
static Integer COMMITTING
           
static String CONTEXT
           
static String DEFAULT_GROUP
           
static Integer DONE
           
protected  Map groups
           
static String GROUPS
           
static String HEAD
           
static long MAX_PARTICIPANTS
           
static long MAX_WAIT
           
static Integer PREPARING
           
static String RETRY_QUEUE
           
static String STATE
           
static String TAIL
           
static String TAILLOCK
           
 
Fields inherited from class org.jpos.q2.QBeanSupport
cfg, log
 
Fields inherited from interface org.jpos.transaction.TransactionConstants
ABORTED, NO_JOIN, PAUSE, PREPARED, READONLY, RETRY
 
Fields inherited from interface org.jpos.q2.QBean
DESTROYED, FAILED, STARTED, STARTING, stateString, STOPPED, STOPPING
 
Constructor Summary
TransactionManager()
           
 
Method Summary
protected  void abort(int session, long id, Serializable context, List members, boolean recover, LogEvent evt, Profiler prof)
           
protected  void abort(TransactionParticipant p, long id, Serializable context)
           
protected  void addGroup(long id, String groupName)
           
 void addListener(TransactionStatusListener l)
           
protected  void checkRetryTask()
           
protected  void checkTail()
           
protected  void commit(int session, long id, Serializable context, List members, boolean recover, LogEvent evt, Profiler prof)
           
protected  void commit(TransactionParticipant p, long id, Serializable context)
           
protected  void commitOff(Space sp)
           
protected  void commitOn(Space sp)
           
 TransactionParticipant createParticipant(org.jdom.Element e)
           
 int getActiveSessions()
           
 boolean getDebug()
           
 long getHead()
           
 Space getInputSpace()
           
 long getInTransit()
           
protected  String getKey(String prefix, long id)
           
 int getOutstandingTransactions()
           
protected  List getParticipants(long id)
           
protected  List getParticipants(String groupName)
           
 Space getPersistentSpace()
           
 String getQueueName()
           
 int getRunningSessions()
           
 Space getSpace()
           
 long getTail()
           
 TPS getTPS()
           
protected  long initCounter(String name, long defValue)
           
protected  ArrayList initGroup(org.jdom.Element e)
           
protected  void initParticipants(org.jdom.Element config)
           
 void initService()
           
protected  void initStatusListeners(org.jdom.Element config)
           
protected  void initTailLock()
           
protected  long nextId()
           
protected  int prepare(int session, long id, Serializable context, List members, Iterator iter, boolean abort, LogEvent evt, Profiler prof)
           
protected  int prepare(TransactionParticipant p, long id, Serializable context)
           
protected  int prepareForAbort(TransactionParticipant p, long id, Serializable context)
           
protected  void purge(long id)
           
 void push(Serializable context)
           
 void queue(Serializable context)
           
protected  void recover()
           
protected  void recover(int session, long id)
           
 void removeListener(TransactionStatusListener l)
           
 void run()
           
 void setConfiguration(Configuration cfg)
           
 void setDebug(boolean debug)
           
protected  void setState(long id, Integer state)
           
protected  void snapshot(long id, Serializable context)
           
protected  void snapshot(long id, Serializable context, Integer status)
           
 void startService()
           
 void stopService()
           
protected  void syncTail()
           
protected  boolean tailDone()
           
 
Methods inherited from class org.jpos.q2.QBeanSupport
addAttr, createElement, destroy, destroyService, getAttrs, getAttrs, getConfiguration, getFactory, getLoader, getLoaderURLS, getLog, getLogger, getName, getPersist, getProperties, getProperty, getRealm, getServer, getState, getStateAsString, init, isModified, running, setAttr, setLogger, setModified, setName, setPersist, setProperty, setRealm, setServer, setState, shutdownQ2, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jpos.q2.QBeanSupportMBean
getLoader, getLoaderURLS, getLogger, getName, getRealm, getServer, setLogger, setName, setPersist, setRealm, setServer, shutdownQ2
 
Methods inherited from interface org.jpos.q2.QBean
destroy, getState, getStateAsString, init, start, stop
 
Methods inherited from interface org.jpos.q2.QPersist
getPersist, isModified
 

Field Detail

HEAD

public static final String HEAD
See Also:
Constant Field Values

TAIL

public static final String TAIL
See Also:
Constant Field Values

CONTEXT

public static final String CONTEXT
See Also:
Constant Field Values

STATE

public static final String STATE
See Also:
Constant Field Values

GROUPS

public static final String GROUPS
See Also:
Constant Field Values

TAILLOCK

public static final String TAILLOCK
See Also:
Constant Field Values

RETRY_QUEUE

public static final String RETRY_QUEUE
See Also:
Constant Field Values

PREPARING

public static final Integer PREPARING

COMMITTING

public static final Integer COMMITTING

DONE

public static final Integer DONE

DEFAULT_GROUP

public static final String DEFAULT_GROUP
See Also:
Constant Field Values

MAX_PARTICIPANTS

public static final long MAX_PARTICIPANTS
See Also:
Constant Field Values

MAX_WAIT

public static final long MAX_WAIT
See Also:
Constant Field Values

groups

protected Map groups
Constructor Detail

TransactionManager

public TransactionManager()
Method Detail

initService

public void initService()
                 throws ConfigurationException
Overrides:
initService in class QBeanSupport
Throws:
ConfigurationException

startService

public void startService()
                  throws Exception
Overrides:
startService in class QBeanSupport
Throws:
Exception

stopService

public void stopService()
                 throws Exception
Overrides:
stopService in class QBeanSupport
Throws:
Exception

queue

public void queue(Serializable context)

push

public void push(Serializable context)

getQueueName

public String getQueueName()

getSpace

public Space getSpace()

getInputSpace

public Space getInputSpace()

getPersistentSpace

public Space getPersistentSpace()

run

public void run()
Specified by:
run in interface Runnable

getTail

public long getTail()
Specified by:
getTail in interface TransactionManagerMBean

getHead

public long getHead()
Specified by:
getHead in interface TransactionManagerMBean

getInTransit

public long getInTransit()

setConfiguration

public void setConfiguration(Configuration cfg)
                      throws ConfigurationException
Specified by:
setConfiguration in interface Configurable
Overrides:
setConfiguration in class QBeanSupport
Parameters:
cfg - Configuration object
Throws:
ConfigurationException

addListener

public void addListener(TransactionStatusListener l)

removeListener

public void removeListener(TransactionStatusListener l)

getTPS

public TPS getTPS()

commit

protected void commit(int session,
                      long id,
                      Serializable context,
                      List members,
                      boolean recover,
                      LogEvent evt,
                      Profiler prof)

abort

protected void abort(int session,
                     long id,
                     Serializable context,
                     List members,
                     boolean recover,
                     LogEvent evt,
                     Profiler prof)

prepareForAbort

protected int prepareForAbort(TransactionParticipant p,
                              long id,
                              Serializable context)

prepare

protected int prepare(TransactionParticipant p,
                      long id,
                      Serializable context)

commit

protected void commit(TransactionParticipant p,
                      long id,
                      Serializable context)

abort

protected void abort(TransactionParticipant p,
                     long id,
                     Serializable context)

prepare

protected int prepare(int session,
                      long id,
                      Serializable context,
                      List members,
                      Iterator iter,
                      boolean abort,
                      LogEvent evt,
                      Profiler prof)

getParticipants

protected List getParticipants(String groupName)

getParticipants

protected List getParticipants(long id)

initStatusListeners

protected void initStatusListeners(org.jdom.Element config)
                            throws ConfigurationException
Throws:
ConfigurationException

initParticipants

protected void initParticipants(org.jdom.Element config)
                         throws ConfigurationException
Throws:
ConfigurationException

initGroup

protected ArrayList initGroup(org.jdom.Element e)
                       throws ConfigurationException
Throws:
ConfigurationException

createParticipant

public TransactionParticipant createParticipant(org.jdom.Element e)
                                         throws ConfigurationException
Throws:
ConfigurationException

getOutstandingTransactions

public int getOutstandingTransactions()
Specified by:
getOutstandingTransactions in interface TransactionManagerMBean

getKey

protected String getKey(String prefix,
                        long id)

initCounter

protected long initCounter(String name,
                           long defValue)

commitOff

protected void commitOff(Space sp)

commitOn

protected void commitOn(Space sp)

syncTail

protected void syncTail()

initTailLock

protected void initTailLock()

checkTail

protected void checkTail()

tailDone

protected boolean tailDone()

nextId

protected long nextId()

snapshot

protected void snapshot(long id,
                        Serializable context)

snapshot

protected void snapshot(long id,
                        Serializable context,
                        Integer status)

setState

protected void setState(long id,
                        Integer state)

addGroup

protected void addGroup(long id,
                        String groupName)

purge

protected void purge(long id)

recover

protected void recover()

recover

protected void recover(int session,
                       long id)

checkRetryTask

protected void checkRetryTask()

setDebug

public void setDebug(boolean debug)
Specified by:
setDebug in interface TransactionManagerMBean

getDebug

public boolean getDebug()
Specified by:
getDebug in interface TransactionManagerMBean

getActiveSessions

public int getActiveSessions()
Specified by:
getActiveSessions in interface TransactionManagerMBean

getRunningSessions

public int getRunningSessions()


Copyright © 1998-2012 jPOS.org. All Rights Reserved.