@Service
@ContractsProvided(value={javax.transaction.TransactionManager.class,JavaEETransactionManager.class})
@Rank(value=50)
public class JavaEETransactionManagerSimplified
extends Object
implements JavaEETransactionManager, org.glassfish.hk2.api.PostConstruct
| Modifier and Type | Field and Description |
|---|---|
protected Logger |
_logger |
protected InvocationManager |
invMgr |
| Constructor and Description |
|---|
JavaEETransactionManagerSimplified() |
| Modifier and Type | Method and Description |
|---|---|
void |
begin() |
void |
begin(int timeout)
This method is introduced as part of implementing the local transaction timeout
capability.
|
void |
checkTransactionExport(boolean isLocal)
Called from the CORBA Interceptors on the client-side when
a client makes a call to a remote object (not in the same JVM).
|
void |
checkTransactionImport()
Called from the CORBA Interceptors on the server-side when
the server is replying to the client (local + remote client).
|
void |
cleanTxnTimeout() |
void |
clearThreadTx()
Clears the transaction associated with the caller thread
|
void |
commit() |
void |
componentDestroyed(Object instance)
This is called by Container to indicate that a component
is being destroyed.
|
void |
componentDestroyed(Object instance,
ComponentInvocation inv)
This is called by Container to indicate that a component
is being destroyed.
|
void |
componentDestroyed(ResourceHandler rh)
This is called by Container to indicate that a component
is being destroyed.
|
JavaEETransaction |
createImportedTransaction(TransactionInternal jtsTx) |
void |
delistComponentResources(boolean suspend)
This is called by the Container to ask the Transaction
Manager to delist all resources held by a component
The TM finds the component through the InvocationManager
|
boolean |
delistResource(Transaction tran,
TransactionalResource h,
int flag)
Delist the resource specified from the transaction
|
void |
enlistComponentResources()
This is called by the Container to ask the Transaction
Manager to enlist all resources held by a component and
to associate the current Transaction with the current
Invocation
The TM finds the component through the InvocationManager
|
boolean |
enlistResource(Transaction tran,
TransactionalResource h)
Enlist the resource specified with the transaction
|
protected boolean |
enlistXAResource(Transaction tran,
TransactionalResource h) |
void |
forceRollback(String txnId) |
void |
freeze() |
ArrayList |
getActiveTransactions() |
JavaEETransaction |
getCurrentTransaction()
Return JavaEETransaction instance associated with the current thread.
|
int |
getEffectiveTimeout() |
List |
getExistingResourceList(Object instance,
ComponentInvocation inv)
Returns a list of resource handles held by the component
|
Logger |
getLogger() |
int |
getPurgeCancelledTtransactionsAfter()
Returns the value to be used to purge transaction tasks after the
specified number of cancelled tasks.
|
List |
getResourceList(Object instance,
ComponentInvocation inv)
get the resources being used in the calling component's invocation context
|
int |
getStatus() |
static String |
getStatusAsString(int status) |
Transaction |
getTransaction() |
TransactionAdminBean |
getTransactionAdminBean(Transaction tran) |
String |
getTxLogLocation()
Return location of transaction logs
|
XAResourceWrapper |
getXAResourceWrapper(String clName)
Return XAResourceWrapper instance specific to this datasource class name
that can be used instead of the driver provided version for transaction recovery.
|
javax.resource.spi.XATerminator |
getXATerminator()
This is used by importing transactions via the Connector contract.
|
void |
handlePropertyUpdate(String name,
Object value)
Handle configuration change.
|
void |
initRecovery(boolean force)
Initialize recovery framework
|
boolean |
isDelegate(JavaEETransactionManagerDelegate d) |
boolean |
isFrozen()
XXX ???
|
boolean |
isInvocationStackEmpty() |
boolean |
isNullTransaction()
Return true if a "null transaction context" was received
from the client.
|
boolean |
isTimedOut()
Utility for the ejb container to check if the transaction is marked for
rollback because of timeout.
|
void |
monitorTxBegin(Transaction tx) |
void |
monitorTxCompleted(Object obj,
boolean b) |
void |
postConstruct() |
void |
postInvoke(ComponentInvocation curr,
ComponentInvocation prev)
Called by InvocationManager
|
void |
preInvoke(ComponentInvocation prev)
Called by InvocationManager
|
void |
recover(XAResource[] resourceList) |
boolean |
recoverIncompleteTx(boolean delegated,
String logPath,
XAResource[] xaresArray)
Called by the ResourceRecoveryManager to recover the populated
array of XAResource.
|
void |
recreate(Xid xid,
long timeout)
Recreate a transaction based on the Xid.
|
void |
registerComponentResource(TransactionalResource h) |
void |
registerRecoveryResourceHandler(XAResource xaResource)
Allows an arbitrary XAResource to register for recovery
|
void |
registerSynchronization(Synchronization sync)
register a synchronization object with the transaction
associated with the current thread
|
void |
release(Xid xid)
Release a transaction.
|
boolean |
resourceEnlistable(TransactionalResource h) |
void |
resume(Transaction tobj) |
void |
rollback() |
void |
setCurrentTransaction(JavaEETransaction t)
Update JavaEETransaction associated with the current thread.
|
void |
setDefaultTransactionTimeout(int seconds) |
void |
setDelegate(JavaEETransactionManagerDelegate d)
Explicitly set the JavaEETransactionManagerDelegate instance
for implementation-specific callbacks.
|
void |
setMonitoringEnabled(boolean enabled) |
void |
setPurgeCancelledTtransactionsAfter(int num)
Modify the value to be used to purge transaction tasks after the
specified number of cancelled tasks.
|
void |
setRollbackOnly() |
void |
setTransactionCompeting(boolean b) |
void |
setTransactionTimeout(int seconds)
Modify the value of the timeout value that is associated with the
transactions started by the current thread with the begin method.
|
void |
shutdown()
Perform shutdown cleanup.
|
void |
startJTSTx(JavaEETransaction t) |
Transaction |
suspend() |
void |
unfreeze() |
void |
unregisterComponentResource(TransactionalResource h) |
protected Logger _logger
@Inject protected InvocationManager invMgr
public void postConstruct()
postConstruct in interface org.glassfish.hk2.api.PostConstructpublic void clearThreadTx()
clearThreadTx in interface JavaEETransactionManagerpublic String getTxLogLocation()
getTxLogLocation in interface JavaEETransactionManagerpublic void registerRecoveryResourceHandler(XAResource xaResource)
registerRecoveryResourceHandler in interface JavaEETransactionManagerxaResource - XAResource to register for recoverypublic boolean isNullTransaction()
isNullTransaction in interface JavaEETransactionManagerpublic void shutdown()
JavaEETransactionManagershutdown in interface JavaEETransactionManagerpublic void initRecovery(boolean force)
JavaEETransactionManagerinitRecovery in interface JavaEETransactionManagerforce - if true, forces initialization, otherwise relies on the TimerService
configuration.public void recover(XAResource[] resourceList)
recover in interface JavaEETransactionManagerpublic boolean enlistResource(Transaction tran, TransactionalResource h) throws RollbackException, IllegalStateException, SystemException
JavaEETransactionManagerenlistResource in interface JavaEETransactionManagertran - The transaction objecth - The resource handle objectRollbackException - Thrown to indicate that
the transaction has been marked for rollback only.IllegalStateException - Thrown if the transaction in the
target object is in prepared state or the transaction is inactive.SystemException - Thrown if the transaction manager
encounters an unexpected error conditionpublic void unregisterComponentResource(TransactionalResource h)
unregisterComponentResource in interface JavaEETransactionManagerpublic void startJTSTx(JavaEETransaction t) throws RollbackException, IllegalStateException, SystemException
public List getResourceList(Object instance, ComponentInvocation inv)
getResourceList in interface JavaEETransactionManagerinstance - Calling component instanceinv - Calling component's invocation informationpublic void enlistComponentResources()
throws RemoteException
JavaEETransactionManagerenlistComponentResources in interface JavaEETransactionManagerRemoteExceptionpublic boolean delistResource(Transaction tran, TransactionalResource h, int flag) throws IllegalStateException, SystemException
JavaEETransactionManagerdelistResource in interface JavaEETransactionManagertran - The transaction objecth - The resource handle objectflag - One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL.IllegalStateException - Thrown if the transaction in the
target object is inactive.SystemException - Thrown if the transaction manager
encounters an unexpected error conditionpublic void delistComponentResources(boolean suspend)
throws RemoteException
JavaEETransactionManagerdelistComponentResources in interface JavaEETransactionManagersuspend - true if the resources should be delisted
with TMSUSPEND flag; false otherwiseRemoteExceptionpublic void registerComponentResource(TransactionalResource h)
registerComponentResource in interface JavaEETransactionManagerpublic List getExistingResourceList(Object instance, ComponentInvocation inv)
JavaEETransactionManagergetExistingResourceList in interface JavaEETransactionManagerpublic void preInvoke(ComponentInvocation prev) throws InvocationException
JavaEETransactionManagerpreInvoke in interface JavaEETransactionManagerInvocationExceptionpublic void postInvoke(ComponentInvocation curr, ComponentInvocation prev) throws InvocationException
JavaEETransactionManagerpostInvoke in interface JavaEETransactionManagerInvocationExceptionpublic void componentDestroyed(Object instance)
JavaEETransactionManagercomponentDestroyed in interface JavaEETransactionManagerinstance - The component instancepublic void componentDestroyed(Object instance, ComponentInvocation inv)
JavaEETransactionManagercomponentDestroyed in interface JavaEETransactionManagerinstance - The component instanceinv - The ComponentInvocationpublic void componentDestroyed(ResourceHandler rh)
JavaEETransactionManagercomponentDestroyed in interface JavaEETransactionManagerrh - The ResourceHandlerpublic boolean isTimedOut()
JavaEETransactionManagerisTimedOut in interface JavaEETransactionManagerpublic void checkTransactionImport()
checkTransactionImport in interface JavaEETransactionManagerpublic void checkTransactionExport(boolean isLocal)
checkTransactionExport in interface JavaEETransactionManagerRuntimeException - if the transaction is not exportablepublic javax.resource.spi.XATerminator getXATerminator()
getXATerminator in interface JavaEETransactionManagerXATerminator instance.UnsupportedOperationExceptionpublic void release(Xid xid) throws javax.resource.spi.work.WorkException
This is used by importing transactions via the Connector contract.
release in interface JavaEETransactionManagerxid - the Xid object representing a transaction.javax.resource.spi.work.WorkExceptionpublic void recreate(Xid xid, long timeout) throws javax.resource.spi.work.WorkException
This is used by importing transactions via the Connector contract.
recreate in interface JavaEETransactionManagerxid - the Xid object representing a transaction.javax.resource.spi.work.WorkExceptionpublic void registerSynchronization(Synchronization sync) throws IllegalStateException, SystemException
JavaEETransactionManagerregisterSynchronization in interface JavaEETransactionManagersync - the synchronization objectIllegalStateException - Thrown if the transaction in the
target object is in prepared state or the transaction is inactive.SystemException - Thrown if the transaction manager
encounters an unexpected error conditionpublic void begin()
throws NotSupportedException,
SystemException
begin in interface TransactionManagerNotSupportedExceptionSystemExceptionpublic void begin(int timeout)
throws NotSupportedException,
SystemException
begin in interface JavaEETransactionManagerNotSupportedExceptionSystemExceptionpublic void commit()
throws RollbackException,
HeuristicMixedException,
HeuristicRollbackException,
SecurityException,
IllegalStateException,
SystemException
commit in interface TransactionManagerRollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionIllegalStateExceptionSystemExceptionpublic void rollback()
throws IllegalStateException,
SecurityException,
SystemException
rollback in interface TransactionManagerIllegalStateExceptionSecurityExceptionSystemExceptionpublic int getStatus()
throws SystemException
getStatus in interface TransactionManagerSystemExceptionpublic Transaction getTransaction() throws SystemException
getTransaction in interface TransactionManagerSystemExceptionpublic void setRollbackOnly()
throws IllegalStateException,
SystemException
setRollbackOnly in interface TransactionManagerIllegalStateExceptionSystemExceptionpublic Transaction suspend() throws SystemException
suspend in interface TransactionManagerSystemExceptionpublic void resume(Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException
resume in interface TransactionManagerInvalidTransactionExceptionIllegalStateExceptionSystemExceptionpublic void setTransactionTimeout(int seconds)
throws SystemException
If an application has not called this method, the transaction service uses some default value for the transaction timeout.
setTransactionTimeout in interface TransactionManagerSystemException - Thrown if the transaction manager
encounters an unexpected error conditionpublic void setPurgeCancelledTtransactionsAfter(int num)
setPurgeCancelledTtransactionsAfter in interface JavaEETransactionManagerpublic int getPurgeCancelledTtransactionsAfter()
getPurgeCancelledTtransactionsAfter in interface JavaEETransactionManagerpublic JavaEETransaction getCurrentTransaction()
JavaEETransactionManagergetCurrentTransaction in interface JavaEETransactionManagerpublic void setCurrentTransaction(JavaEETransaction t)
JavaEETransactionManagersetCurrentTransaction in interface JavaEETransactionManagert - the JavaEETransaction associated with the current thread or null
if the existing transaction had been completed.public XAResourceWrapper getXAResourceWrapper(String clName)
JavaEETransactionManagergetXAResourceWrapper in interface JavaEETransactionManagerclName - the class name of a datasource.public void handlePropertyUpdate(String name, Object value)
JavaEETransactionManagerhandlePropertyUpdate in interface JavaEETransactionManagername - the name of the configuration property.value - the ne value of the configuration.public boolean recoverIncompleteTx(boolean delegated,
String logPath,
XAResource[] xaresArray)
throws Exception
JavaEETransactionManagerrecoverIncompleteTx in interface JavaEETransactionManagerdelegated - true if the recovery process is owned by this instance.logPath - the name of the transaction logging directoryxaresArray - the array of XA Resources to be recovered.Exceptionpublic void freeze()
freeze in interface JavaEETransactionManagerpublic void unfreeze()
unfreeze in interface JavaEETransactionManagerpublic boolean isFrozen()
isFrozen in interface JavaEETransactionManagerpublic void cleanTxnTimeout()
cleanTxnTimeout in interface JavaEETransactionManagerpublic int getEffectiveTimeout()
public void setDefaultTransactionTimeout(int seconds)
setDefaultTransactionTimeout in interface JavaEETransactionManagerpublic ArrayList getActiveTransactions()
getActiveTransactions in interface JavaEETransactionManagerpublic TransactionAdminBean getTransactionAdminBean(Transaction tran) throws SystemException
SystemExceptionpublic void forceRollback(String txnId) throws IllegalStateException, SystemException
forceRollback in interface JavaEETransactionManagerIllegalStateExceptionSystemExceptionpublic void setMonitoringEnabled(boolean enabled)
setMonitoringEnabled in interface JavaEETransactionManagerpublic static String getStatusAsString(int status)
protected boolean enlistXAResource(Transaction tran, TransactionalResource h) throws RollbackException, IllegalStateException, SystemException
public boolean isDelegate(JavaEETransactionManagerDelegate d)
public void setDelegate(JavaEETransactionManagerDelegate d)
JavaEETransactionManagersetDelegate in interface JavaEETransactionManagerd - the JavaEETransactionManagerDelegate instance.public Logger getLogger()
public void monitorTxCompleted(Object obj, boolean b)
public void monitorTxBegin(Transaction tx)
public boolean resourceEnlistable(TransactionalResource h)
public boolean isInvocationStackEmpty()
public void setTransactionCompeting(boolean b)
public JavaEETransaction createImportedTransaction(TransactionInternal jtsTx) throws SystemException
SystemExceptionCopyright © 2019. All rights reserved.