Package org.apache.openjpa.ee
Interface ManagedRuntime
-
- All Known Implementing Classes:
AbstractManagedRuntime
,AutomaticManagedRuntime
,InvocationManagedRuntime
,JNDIManagedRuntime
,OSGiManagedRuntime
,RegistryManagedRuntime
,SunOneManagedRuntime
,WASManagedRuntime
,WASRegistryManagedRuntime
,WLSManagedRuntime
public interface ManagedRuntime
This interface must be implemented by concrete plugins to application servers in order to integrate the OpenJPA runtime in a managed environment.- Author:
- Abe White
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
doNonTransactionalWork(java.lang.Runnable runnable)
Do a unit of work which will execute outside of the current managed transaction.java.lang.Throwable
getRollbackCause()
Returns the Throwable that caused the current transaction to be marked for rollback, provided that any exists.java.lang.Object
getTransactionKey()
Returns a transaction key that can be used to associate transactions and Brokers.jakarta.transaction.TransactionManager
getTransactionManager()
Return the TransactionManager for the managed runtime.void
setRollbackOnly(java.lang.Throwable cause)
Sets the rollback only flag on the current transaction.
-
-
-
Method Detail
-
getTransactionManager
jakarta.transaction.TransactionManager getTransactionManager() throws java.lang.Exception
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.- Throws:
java.lang.Exception
-
setRollbackOnly
void setRollbackOnly(java.lang.Throwable cause) throws java.lang.Exception
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.- Parameters:
cause
- the Throwable that caused the transaction to be marked for rollback, or null of none is known- Throws:
java.lang.Exception
-
getRollbackCause
java.lang.Throwable getRollbackCause() throws java.lang.Exception
Returns the Throwable that caused the current transaction to be marked for rollback, provided that any exists.- Returns:
- the Throwable cause, or null if none
- Throws:
java.lang.Exception
-
getTransactionKey
java.lang.Object getTransactionKey() throws java.lang.Exception, jakarta.transaction.SystemException
Returns a transaction key that can be used to associate transactions and Brokers.- Returns:
- the transaction key
- Throws:
java.lang.Exception
jakarta.transaction.SystemException
-
doNonTransactionalWork
void doNonTransactionalWork(java.lang.Runnable runnable) throws jakarta.transaction.NotSupportedException
Do a unit of work which will execute outside of the current managed transaction.
If the runnable object encounters an exception it should be wrapped in a RuntimeException and thrown back to the caller
- Parameters:
runnable
- The runnable wrapper for the work that will be done. The runnable object should be fully initialized with any state needed to execute.- Throws:
jakarta.transaction.NotSupportedException
- if the transaction can not be suspended.
-
-