@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.PostConstruct
public void clearThreadTx()
clearThreadTx
in interface JavaEETransactionManager
public String getTxLogLocation()
getTxLogLocation
in interface JavaEETransactionManager
public void registerRecoveryResourceHandler(XAResource xaResource)
registerRecoveryResourceHandler
in interface JavaEETransactionManager
xaResource
- XAResource to register for recoverypublic boolean isNullTransaction()
isNullTransaction
in interface JavaEETransactionManager
public void shutdown()
JavaEETransactionManager
shutdown
in interface JavaEETransactionManager
public void initRecovery(boolean force)
JavaEETransactionManager
initRecovery
in interface JavaEETransactionManager
force
- if true, forces initialization, otherwise relies on the TimerService
configuration.public void recover(XAResource[] resourceList)
recover
in interface JavaEETransactionManager
public boolean enlistResource(Transaction tran, TransactionalResource h) throws RollbackException, IllegalStateException, SystemException
JavaEETransactionManager
enlistResource
in interface JavaEETransactionManager
tran
- 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 JavaEETransactionManager
public void startJTSTx(JavaEETransaction t) throws RollbackException, IllegalStateException, SystemException
public List getResourceList(Object instance, ComponentInvocation inv)
getResourceList
in interface JavaEETransactionManager
instance
- Calling component instanceinv
- Calling component's invocation informationpublic void enlistComponentResources() throws RemoteException
JavaEETransactionManager
enlistComponentResources
in interface JavaEETransactionManager
RemoteException
public boolean delistResource(Transaction tran, TransactionalResource h, int flag) throws IllegalStateException, SystemException
JavaEETransactionManager
delistResource
in interface JavaEETransactionManager
tran
- 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
JavaEETransactionManager
delistComponentResources
in interface JavaEETransactionManager
suspend
- true if the resources should be delisted
with TMSUSPEND flag; false otherwiseRemoteException
public void registerComponentResource(TransactionalResource h)
registerComponentResource
in interface JavaEETransactionManager
public List getExistingResourceList(Object instance, ComponentInvocation inv)
JavaEETransactionManager
getExistingResourceList
in interface JavaEETransactionManager
public void preInvoke(ComponentInvocation prev) throws InvocationException
JavaEETransactionManager
preInvoke
in interface JavaEETransactionManager
InvocationException
public void postInvoke(ComponentInvocation curr, ComponentInvocation prev) throws InvocationException
JavaEETransactionManager
postInvoke
in interface JavaEETransactionManager
InvocationException
public void componentDestroyed(Object instance)
JavaEETransactionManager
componentDestroyed
in interface JavaEETransactionManager
instance
- The component instancepublic void componentDestroyed(Object instance, ComponentInvocation inv)
JavaEETransactionManager
componentDestroyed
in interface JavaEETransactionManager
instance
- The component instanceinv
- The ComponentInvocationpublic void componentDestroyed(ResourceHandler rh)
JavaEETransactionManager
componentDestroyed
in interface JavaEETransactionManager
rh
- The ResourceHandlerpublic boolean isTimedOut()
JavaEETransactionManager
isTimedOut
in interface JavaEETransactionManager
public void checkTransactionImport()
checkTransactionImport
in interface JavaEETransactionManager
public void checkTransactionExport(boolean isLocal)
checkTransactionExport
in interface JavaEETransactionManager
RuntimeException
- if the transaction is not exportablepublic javax.resource.spi.XATerminator getXATerminator()
getXATerminator
in interface JavaEETransactionManager
XATerminator
instance.UnsupportedOperationException
public void release(Xid xid) throws javax.resource.spi.work.WorkException
This is used by importing transactions via the Connector contract.
release
in interface JavaEETransactionManager
xid
- the Xid object representing a transaction.javax.resource.spi.work.WorkException
public 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 JavaEETransactionManager
xid
- the Xid object representing a transaction.javax.resource.spi.work.WorkException
public void registerSynchronization(Synchronization sync) throws IllegalStateException, SystemException
JavaEETransactionManager
registerSynchronization
in interface JavaEETransactionManager
sync
- 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 TransactionManager
NotSupportedException
SystemException
public void begin(int timeout) throws NotSupportedException, SystemException
begin
in interface JavaEETransactionManager
NotSupportedException
SystemException
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
commit
in interface TransactionManager
RollbackException
HeuristicMixedException
HeuristicRollbackException
SecurityException
IllegalStateException
SystemException
public void rollback() throws IllegalStateException, SecurityException, SystemException
rollback
in interface TransactionManager
IllegalStateException
SecurityException
SystemException
public int getStatus() throws SystemException
getStatus
in interface TransactionManager
SystemException
public Transaction getTransaction() throws SystemException
getTransaction
in interface TransactionManager
SystemException
public void setRollbackOnly() throws IllegalStateException, SystemException
setRollbackOnly
in interface TransactionManager
IllegalStateException
SystemException
public Transaction suspend() throws SystemException
suspend
in interface TransactionManager
SystemException
public void resume(Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException
resume
in interface TransactionManager
InvalidTransactionException
IllegalStateException
SystemException
public 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 TransactionManager
SystemException
- Thrown if the transaction manager
encounters an unexpected error conditionpublic void setPurgeCancelledTtransactionsAfter(int num)
setPurgeCancelledTtransactionsAfter
in interface JavaEETransactionManager
public int getPurgeCancelledTtransactionsAfter()
getPurgeCancelledTtransactionsAfter
in interface JavaEETransactionManager
public JavaEETransaction getCurrentTransaction()
JavaEETransactionManager
getCurrentTransaction
in interface JavaEETransactionManager
public void setCurrentTransaction(JavaEETransaction t)
JavaEETransactionManager
setCurrentTransaction
in interface JavaEETransactionManager
t
- the JavaEETransaction associated with the current thread or null
if the existing transaction had been completed.public XAResourceWrapper getXAResourceWrapper(String clName)
JavaEETransactionManager
getXAResourceWrapper
in interface JavaEETransactionManager
clName
- the class name of a datasource.public void handlePropertyUpdate(String name, Object value)
JavaEETransactionManager
handlePropertyUpdate
in interface JavaEETransactionManager
name
- the name of the configuration property.value
- the ne value of the configuration.public boolean recoverIncompleteTx(boolean delegated, String logPath, XAResource[] xaresArray) throws Exception
JavaEETransactionManager
recoverIncompleteTx
in interface JavaEETransactionManager
delegated
- 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.Exception
public void freeze()
freeze
in interface JavaEETransactionManager
public void unfreeze()
unfreeze
in interface JavaEETransactionManager
public boolean isFrozen()
isFrozen
in interface JavaEETransactionManager
public void cleanTxnTimeout()
cleanTxnTimeout
in interface JavaEETransactionManager
public int getEffectiveTimeout()
public void setDefaultTransactionTimeout(int seconds)
setDefaultTransactionTimeout
in interface JavaEETransactionManager
public ArrayList getActiveTransactions()
getActiveTransactions
in interface JavaEETransactionManager
public TransactionAdminBean getTransactionAdminBean(Transaction tran) throws SystemException
SystemException
public void forceRollback(String txnId) throws IllegalStateException, SystemException
forceRollback
in interface JavaEETransactionManager
IllegalStateException
SystemException
public void setMonitoringEnabled(boolean enabled)
setMonitoringEnabled
in interface JavaEETransactionManager
public 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)
JavaEETransactionManager
setDelegate
in interface JavaEETransactionManager
d
- 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
SystemException
Copyright © 2020. All rights reserved.