ehcache

net.sf.ehcache
Class TransactionController

java.lang.Object
  extended by net.sf.ehcache.TransactionController

public final class TransactionController
extends Object

TransactionController is used to begin, commit and rollback local transactions

Author:
Ludovic Orban

Method Summary
 void begin()
          Begin a new transaction and bind its context to the current thread
 void begin(int transactionTimeoutSeconds)
          Begin a new transaction with the specified timeout and bind its context to the current thread
 void commit()
          Commit the transaction bound to the current thread
 void commit(boolean ignoreTimeout)
          Commit the transaction bound to the current thread, ignoring if the transaction timed out
 LocalTransactionContext getCurrentTransactionContext()
          Get the transaction context bond to the current thread
 int getDefaultTransactionTimeout()
          Get the default transaction timeout in seconds
 LocalRecoveryManager getRecoveryManager()
          Get the local transactions recovery manager of this cache manager
 long getTransactionCommittedCount()
          Get the committed transactions count
 long getTransactionRolledBackCount()
          Get the rolled back transactions count
 long getTransactionTimedOutCount()
          Get the timed out transactions count.
 void rollback()
          Rollback the transaction bound to the current thread
 void setDefaultTransactionTimeout(int defaultTransactionTimeoutSeconds)
          Set the default transaction timeout in seconds, it must be > 0
 void setRollbackOnly()
          Mark the transaction bound to the current thread for rollback only
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefaultTransactionTimeout

public int getDefaultTransactionTimeout()
Get the default transaction timeout in seconds

Returns:
the default transaction timeout

setDefaultTransactionTimeout

public void setDefaultTransactionTimeout(int defaultTransactionTimeoutSeconds)
Set the default transaction timeout in seconds, it must be > 0

Parameters:
defaultTransactionTimeoutSeconds - the default transaction timeout

begin

public void begin()
Begin a new transaction and bind its context to the current thread


begin

public void begin(int transactionTimeoutSeconds)
Begin a new transaction with the specified timeout and bind its context to the current thread

Parameters:
transactionTimeoutSeconds - the timeout foe this transaction in seconds

commit

public void commit()
Commit the transaction bound to the current thread


commit

public void commit(boolean ignoreTimeout)
Commit the transaction bound to the current thread, ignoring if the transaction timed out

Parameters:
ignoreTimeout - true if the transaction should be committed no matter if it timed out or not

rollback

public void rollback()
Rollback the transaction bound to the current thread


setRollbackOnly

public void setRollbackOnly()
Mark the transaction bound to the current thread for rollback only


getCurrentTransactionContext

public LocalTransactionContext getCurrentTransactionContext()
Get the transaction context bond to the current thread

Returns:
the transaction context bond to the current thread or null if no transaction started on the current thread

getTransactionCommittedCount

public long getTransactionCommittedCount()
Get the committed transactions count

Returns:
the committed transactions count

getTransactionRolledBackCount

public long getTransactionRolledBackCount()
Get the rolled back transactions count

Returns:
the rolled back transactions count

getTransactionTimedOutCount

public long getTransactionTimedOutCount()
Get the timed out transactions count. Note that only transactions which failed to commit due to a timeout are taken into account

Returns:
the timed out transactions count

getRecoveryManager

public LocalRecoveryManager getRecoveryManager()
Get the local transactions recovery manager of this cache manager

Returns:
the local transactions recovery manager

ehcache

Copyright 2001-2016, Terracotta, Inc.