org.apache.openjpa.kernel
Class LocalManagedRuntime

java.lang.Object
  extended by org.apache.openjpa.ee.AbstractManagedRuntime
      extended by org.apache.openjpa.kernel.LocalManagedRuntime
All Implemented Interfaces:
Transaction, TransactionManager, ManagedRuntime

 class LocalManagedRuntime
extends AbstractManagedRuntime
implements ManagedRuntime, TransactionManager, Transaction

Uses a local implementation of the TransactionManager interface. This manager is valid only for a single Broker. It duplicates non-managed transaction control.

Author:
Abe White

Constructor Summary
LocalManagedRuntime(Broker broker)
          Constructor.
 
Method Summary
 void begin()
           
 void commit()
           
 boolean delistResource(XAResource xaRes, int flag)
           
 boolean enlistResource(XAResource xaRes)
           
 Throwable getRollbackCause()
          Returns the Throwable that caused the current transaction to be marked for rollback, provided that any exists.
 int getStatus()
           
 Transaction getTransaction()
           
 TransactionManager getTransactionManager()
          Return the TransactionManager for the managed runtime.
 void registerSynchronization(Synchronization sync)
           
 void resume(Transaction tobj)
           
 void rollback()
           
 void setRollbackOnly()
           
 void setRollbackOnly(Throwable cause)
          Sets the rollback only flag on the current transaction.
 void setTransactionTimeout(int sec)
           
 Transaction suspend()
           
 
Methods inherited from class org.apache.openjpa.ee.AbstractManagedRuntime
doNonTransactionalWork, getTransactionKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.ee.ManagedRuntime
doNonTransactionalWork, getTransactionKey
 

Constructor Detail

LocalManagedRuntime

public LocalManagedRuntime(Broker broker)
Constructor. Provide broker that will be requesting managed transaction info.

Method Detail

getTransactionManager

public TransactionManager getTransactionManager()
Description copied from interface: ManagedRuntime
Return the TransactionManager for the managed runtime. This manager is used to register synchronization listeners, to map transactional PersistenceManagers to the current transaction, and possibly to enlist XA resources.

Specified by:
getTransactionManager in interface ManagedRuntime

begin

public void begin()
Specified by:
begin in interface TransactionManager

commit

public void commit()
Specified by:
commit in interface Transaction
Specified by:
commit in interface TransactionManager

rollback

public void rollback()
Specified by:
rollback in interface Transaction
Specified by:
rollback in interface TransactionManager

setRollbackOnly

public void setRollbackOnly()
Specified by:
setRollbackOnly in interface Transaction
Specified by:
setRollbackOnly in interface TransactionManager

setRollbackOnly

public void setRollbackOnly(Throwable cause)
Description copied from interface: ManagedRuntime
Sets the rollback only flag on the current transaction. If the TransactionManager is capable of tracking the cause of the rollback-only flag, it will also pass along cause information.

Specified by:
setRollbackOnly in interface ManagedRuntime
Parameters:
cause - the Throwable that caused the transaction to be marked for rollback, or null of none is known

getRollbackCause

public Throwable getRollbackCause()
Description copied from interface: ManagedRuntime
Returns the Throwable that caused the current transaction to be marked for rollback, provided that any exists.

Specified by:
getRollbackCause in interface ManagedRuntime
Returns:
the Throwable cause, or null if none

getStatus

public int getStatus()
Specified by:
getStatus in interface Transaction
Specified by:
getStatus in interface TransactionManager

getTransaction

public Transaction getTransaction()
Specified by:
getTransaction in interface TransactionManager

resume

public void resume(Transaction tobj)
            throws SystemException
Specified by:
resume in interface TransactionManager
Throws:
SystemException

setTransactionTimeout

public void setTransactionTimeout(int sec)
                           throws SystemException
Specified by:
setTransactionTimeout in interface TransactionManager
Throws:
SystemException

suspend

public Transaction suspend()
                    throws SystemException
Specified by:
suspend in interface TransactionManager
Throws:
SystemException

delistResource

public boolean delistResource(XAResource xaRes,
                              int flag)
                       throws SystemException
Specified by:
delistResource in interface Transaction
Throws:
SystemException

enlistResource

public boolean enlistResource(XAResource xaRes)
                       throws SystemException
Specified by:
enlistResource in interface Transaction
Throws:
SystemException

registerSynchronization

public void registerSynchronization(Synchronization sync)
Specified by:
registerSynchronization in interface Transaction


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.