Methods Summary |
---|
public void | begin()
if (!initialized) init();
if (userTx != null) {
userTx.begin();
return;
}
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
checkUserTransactionMethodAccess(inv);
}
transactionManager.begin();
/**
if ( transactionTimeout > 0 )
transactionManager.begin(transactionTimeout);
else
transactionManager.begin();
**/
try {
if (inv != null) {
if ( inv.getInvocationType() == ComponentInvocation.EJB_INVOCATION )
((Container)inv.container).doAfterBegin(inv);
inv.setTransaction(transactionManager.getTransaction());
transactionManager.enlistComponentResources();
}
} catch ( RemoteException ex ) {
_logger.log(Level.SEVERE,"enterprise_distributedtx.excep_in_utx_begin", ex);
SystemException sysEx = new SystemException(ex.getMessage());
sysEx.initCause(ex);
throw sysEx;
}
|
private void | checkUserTransactionMethodAccess(ComponentInvocation inv)
if ( (inv.getInvocationType() == ComponentInvocation.EJB_INVOCATION)
&& checkEjbAccess ) {
Container ejbContainer = (Container) inv.container;
if( !ejbContainer.userTransactionMethodsAllowed(inv) ) {
throw new IllegalStateException(sm.getString("enterprise_distributedtx.operation_not_allowed"));
}
}
|
public void | commit()
if (!initialized) init();
if (userTx != null) {
userTx.commit();
return;
}
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
checkUserTransactionMethodAccess(inv);
}
try {
transactionManager.delistComponentResources(false); // TMSUCCESS
transactionManager.commit();
} catch ( RemoteException ex ) {
_logger.log(Level.SEVERE,"enterprise_distributedtx.excep_in_utx_commit", ex);
throw new SystemException();
} finally {
if (inv != null)
inv.setTransaction(null);
}
|
public int | getStatus()
if (!initialized) init();
if (userTx != null) {
return userTx.getStatus();
}
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
checkUserTransactionMethodAccess(inv);
}
return transactionManager.getStatus();
|
private void | init()Could be called after passivation and reactivation
initialized = true;
Switch theSwitch = Switch.getSwitch();
transactionManager = theSwitch.getTransactionManager();
invocationManager = theSwitch.getInvocationManager();
if (invocationManager == null)
invocationManager = new InvocationManagerImpl();
if (transactionManager == null) {
PEORBConfigurator.initTransactionService(null, new Properties());
transactionManager =
J2EETransactionManagerImpl.createTransactionManager();
theSwitch.setTransactionManager(transactionManager);
// non J2EE client, set up UserTransaction from JTS
// userTx = new com.sun.jts.jta.UserTransactionImpl();
}
|
public void | rollback()
if (!initialized) init();
if (userTx != null) {
userTx.rollback();
return;
}
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
checkUserTransactionMethodAccess(inv);
}
try {
transactionManager.delistComponentResources(false); // TMSUCCESS
transactionManager.rollback();
} catch ( RemoteException ex ) {
_logger.log(Level.SEVERE,"enterprise_distributedtx.excep_in_utx_rollback", ex);
throw new SystemException();
} finally {
if (inv != null)
inv.setTransaction(null);
}
|
public void | setRollbackOnly()
if (!initialized) init();
if (userTx != null) {
userTx.setRollbackOnly();
return;
}
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
checkUserTransactionMethodAccess(inv);
}
transactionManager.setRollbackOnly();
|
public void | setTransactionTimeout(int seconds)
if (!initialized) init();
if (userTx != null) {
userTx.setTransactionTimeout(seconds);
return;
}
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
checkUserTransactionMethodAccess(inv);
}
if (seconds < 0) seconds = 0;
// transactionTimeout = seconds;
transactionManager.setTransactionTimeout(seconds);
|