Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.util.xa
Class AbstractResourceManager

    java.lang.Object
      org.mule.util.xa.AbstractResourceManager

Direct Known Subclasses:
  AbstractXAResourceManager

    public abstract class AbstractResourceManager

extends Object

This code is based on code coming from the commons-transaction project.

Field Summary
`protected static int` | `DEFAULT_COMMIT_TIMEOUT_FACTOR`
`protected static int` | `DEFAULT_TIMEOUT_MSECS`
`protected long` | `defaultTimeout`
`protected boolean` | `dirty`
`protected Collection` | `globalTransactions`
`protected Log` | `logger`
`protected static int` | `OPERATION_MODE_RECOVERING`
`protected static int` | `OPERATION_MODE_STARTED`
`protected static int` | `OPERATION_MODE_STARTING`
`protected static int` | `OPERATION_MODE_STOPPED`
`protected static int` | `OPERATION_MODE_STOPPING`
`protected int` | `operationMode`
`static int` | `SHUTDOWN_MODE_KILL` Shutdown mode: Try to stop active transaction NOW, do no rollbacks
`static int` | `SHUTDOWN_MODE_NORMAL` Shutdown mode: Wait for all transactions to complete
`static int` | `SHUTDOWN_MODE_ROLLBACK` Shutdown mode: Try to roll back all active transactions

Constructor Summary
`AbstractResourceManager()`

Method Summary
`protected void` | `assureReady()` Check that the FileManager is ready.
`protected void` | `assureStarted()` Check that the FileManager is started.
`void` | `beginTransaction(AbstractTransactionContext context)`
`void` | `commitTransaction(AbstractTransactionContext context)`
`protected abstract AbstractTransactionContext` | `createTransactionContext(Object session)`
`protected abstract void` | `doBegin(AbstractTransactionContext context)`
`protected abstract void` | `doCommit(AbstractTransactionContext context)`
`protected abstract int` | `doPrepare(AbstractTransactionContext context)`
`protected abstract void` | `doRollback(AbstractTransactionContext context)`
`protected void` | `doStart()`
`long` | `getDefaultTransactionTimeout()` Gets the default transaction timeout in milliseconds.
`protected abstract Log` | `getLogger()`
`int` | `prepareTransaction(AbstractTransactionContext context)`
`protected void` | `recover()`
`void` | `rollbackTransaction(AbstractTransactionContext context)`
`void` | `setDefaultTransactionTimeout(long timeout)` Sets the default transaction timeout.
`protected void` | `setDirty(AbstractTransactionContext context, Throwable t)` Flag this resource manager as dirty.
`void` | `setTransactionRollbackOnly(AbstractTransactionContext context)`
`protected boolean` | `shutdown(int mode, long timeoutMSecs)`
`void` | `start()`
`AbstractTransactionContext` | `startTransaction(Object session)` Starts a new transaction and associates it with the current thread.
`void` | `stop()`
`boolean` | `stop(int mode)`
`boolean` | `stop(int mode, long timeOut)`
`protected boolean` | `waitForAllTxToStop(long timeoutMSecs)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SHUTDOWN_MODE_NORMAL

    public static final int SHUTDOWN_MODE_NORMAL

  Shutdown mode: Wait for all transactions to complete

  See Also:
    Constant Field Values

### SHUTDOWN_MODE_ROLLBACK

    public static final int SHUTDOWN_MODE_ROLLBACK

  Shutdown mode: Try to roll back all active transactions

  See Also:
    Constant Field Values

### SHUTDOWN_MODE_KILL

    public static final int SHUTDOWN_MODE_KILL

  Shutdown mode: Try to stop active transaction NOW, do no rollbacks

  See Also:
    Constant Field Values

### OPERATION_MODE_STOPPED

    protected static final int OPERATION_MODE_STOPPED

See Also:
  Constant Field Values

### OPERATION_MODE_STOPPING

    protected static final int OPERATION_MODE_STOPPING

See Also:
  Constant Field Values

### OPERATION_MODE_STARTED

    protected static final int OPERATION_MODE_STARTED

See Also:
  Constant Field Values

### OPERATION_MODE_STARTING

    protected static final int OPERATION_MODE_STARTING

See Also:
  Constant Field Values

### OPERATION_MODE_RECOVERING

    protected static final int OPERATION_MODE_RECOVERING

See Also:
  Constant Field Values

### DEFAULT_TIMEOUT_MSECS

    protected static final int DEFAULT_TIMEOUT_MSECS

See Also:
  Constant Field Values

### DEFAULT_COMMIT_TIMEOUT_FACTOR

    protected static final int DEFAULT_COMMIT_TIMEOUT_FACTOR

See Also:
  Constant Field Values

### globalTransactions

    protected Collection globalTransactions

### operationMode

    protected int operationMode

### defaultTimeout

    protected long defaultTimeout

### logger

    protected Log logger

### dirty

    protected boolean dirty

Constructor Detail

### AbstractResourceManager

    public AbstractResourceManager()

Method Detail

### getLogger

    protected abstract Log getLogger()

### start

    public void start()
               throws ResourceManagerSystemException

  Throws:
    `ResourceManagerSystemException`

### doStart

    protected void doStart()
                    throws ResourceManagerSystemException

  Throws:
    `ResourceManagerSystemException`

### recover

    protected void recover()
                    throws ResourceManagerSystemException

  Throws:
    `ResourceManagerSystemException`

### stop

    public void stop()
              throws ResourceManagerSystemException

  Throws:
    `ResourceManagerSystemException`

### stop

    public boolean stop(int mode)
                 throws ResourceManagerSystemException

  Throws:
    `ResourceManagerSystemException`

### stop

    public boolean stop(int mode,
                        long timeOut)
                 throws ResourceManagerSystemException

  Throws:
    `ResourceManagerSystemException`

### shutdown

    protected boolean shutdown(int mode,
                               long timeoutMSecs)

### getDefaultTransactionTimeout

    public long getDefaultTransactionTimeout()

  Gets the default transaction timeout in milliseconds.

### setDefaultTransactionTimeout

    public void setDefaultTransactionTimeout(long timeout)

  Sets the default transaction timeout.

  Parameters:
    `timeout` - timeout in milliseconds

### startTransaction

    public AbstractTransactionContext startTransaction(Object session)
                                                throws ResourceManagerException

  Starts a new transaction and associates it with the current thread. All subsequent changes in the same thread made to the map are invisible from other threads until `commitTransaction(AbstractTransactionContext)` is called. Use `rollbackTransaction(AbstractTransactionContext)` to discard your changes. After calling either method there will be no transaction associated to the current thread any longer.
  Caution: Be careful to finally call one of those methods, as otherwise the transaction will lurk around for ever.

  Throws:
    `ResourceManagerException`
  See Also:
    `prepareTransaction(AbstractTransactionContext)`, `commitTransaction(AbstractTransactionContext)`, `rollbackTransaction(AbstractTransactionContext)`

### beginTransaction

    public void beginTransaction(AbstractTransactionContext context)
                          throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### prepareTransaction

    public int prepareTransaction(AbstractTransactionContext context)
                           throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### rollbackTransaction

    public void rollbackTransaction(AbstractTransactionContext context)
                             throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### setTransactionRollbackOnly

    public void setTransactionRollbackOnly(AbstractTransactionContext context)
                                    throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### commitTransaction

    public void commitTransaction(AbstractTransactionContext context)
                           throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### createTransactionContext

    protected abstract AbstractTransactionContext createTransactionContext(Object session)

### doBegin

    protected abstract void doBegin(AbstractTransactionContext context)

### doPrepare

    protected abstract int doPrepare(AbstractTransactionContext context)

### doCommit

    protected abstract void doCommit(AbstractTransactionContext context)
                              throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### doRollback

    protected abstract void doRollback(AbstractTransactionContext context)
                                throws ResourceManagerException

  Throws:
    `ResourceManagerException`

### waitForAllTxToStop

    protected boolean waitForAllTxToStop(long timeoutMSecs)

### setDirty

    protected void setDirty(AbstractTransactionContext context,
                            Throwable t)

  Flag this resource manager as dirty. No more operations will be allowed until a recovery has been successfully performed.

  Parameters:
    `context` -
    `t` -

### assureStarted

    protected void assureStarted()
                          throws ResourceManagerSystemException

  Check that the FileManager is started.

  Throws:
    `FileManagerSystemException` - if the FileManager is not started.
    `ResourceManagerSystemException`

### assureReady

    protected void assureReady()
                        throws ResourceManagerSystemException

  Check that the FileManager is ready.

  Throws:
    `FileManagerSystemException` - if the FileManager is neither started not stopping.
    `ResourceManagerSystemException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.