Methods Summary |
---|
public void | delistResource(ResourceHandle resource, int xaresFlag)delist the ResourceHandle from the transaction
unregisterResource(resource,xaresFlag);
|
protected void | enlist(J2EETransactionManager tm, javax.transaction.Transaction tran, ResourceHandle h)
try {
tm.enlistResource( tran, h );
} catch( Exception e ) {
PoolingException pe = new PoolingException( e.getMessage() );
pe.initCause( e );
throw pe;
}
|
public void | enlistResource(ResourceHandle h)Enlist the ResourceHandle in the transaction
registerResource(h);
|
public java.lang.Object | getComponent()Returns the component invoking resource request.
InvocationManager invmgr =
Switch.getSwitch().getInvocationManager();
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
return null;
}
return inv.getInstance();
|
public javax.transaction.Transaction | getTransaction()Returns the transaction component is participating.
_logger = LogDomains.getLogger(LogDomains.RSR_LOGGER);
InvocationManager invmgr =
Switch.getSwitch().getInvocationManager();
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
try {
return Switch.getSwitch().getTransactionManager().getTransaction();
} catch (Exception ex) {
return null;
}
}
return inv.getTransaction();
|
public void | registerResource(ResourceHandle handle)Register the ResourceHandle in the transaction
try {
Transaction tran = null;
J2EETransactionManager tm =
Switch.getSwitch().getTransactionManager();
// enlist if necessary
if (handle.isTransactional()) {
InvocationManager invmgr =
Switch.getSwitch().getInvocationManager();
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
//throw new InvocationException();
//Go to the tm and get the transaction
//This is mimicking the current behavior of
//the SystemResourceManagerImpl registerResource method
//in that, you return the transaction from the TxManager
try {
tran = tm.getTransaction();
} catch( Exception e ) {
tran = null;
_logger.log(Level.INFO, e.getMessage());
}
} else {
tran = inv.getTransaction();
tm.registerComponentResource(handle);
}
if (tran != null) {
try{
tm.enlistResource(tran, handle);
} catch (Exception ex) {
_logger.fine("Exception whle trying to enlist resource " + ex.getMessage());
//If transactional, remove the connection handle from the
//component's resource list as there has been exception attempting
//to enlist the resource
if(inv != null) {
_logger.fine("Attempting to unregister component resource");
tm.unregisterComponentResource(handle);
}
throw ex;
}
}
}
} catch (Exception ex) {
_logger.log(Level.SEVERE,"poolmgr.component_register_exception",ex);
throw new PoolingException(ex.toString(), ex);
}
|
public void | rollBackTransaction()Get's the component's transaction and marks it for rolling back.
InvocationManager invmgr =
Switch.getSwitch().getInvocationManager();
J2EETransactionManager tm = Switch.getSwitch().getTransactionManager();
Transaction tran = null;
try {
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
//throw new InvocationException();
//Go to the tm and get the transaction
//This is mimicking the current behavior of
//the SystemResourceManagerImpl registerResource method
//in that, you return the transaction from the TxManager
try {
tran = tm.getTransaction();
} catch( Exception e ) {
tran = null;
_logger.log(Level.INFO, e.getMessage());
}
} else {
tran = inv.getTransaction();
}
if (tran != null) {
tran.setRollbackOnly();
}
} catch (SystemException ex) {
_logger.log(Level.WARNING,"poolmgr.system_exception",ex);
} catch (IllegalStateException ex) {
// ignore
}
|
public void | unregisterResource(ResourceHandle resource, int xaresFlag)Unregister the ResourceHandle from the transaction
J2EETransactionManager tm =
Switch.getSwitch().getTransactionManager();
Transaction tran = null;
try {
// delist with TMSUCCESS if necessary
if (resource.isTransactional()) {
InvocationManager invmgr =
Switch.getSwitch().getInvocationManager();
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
//throw new InvocationException();
//Go to the tm and get the transaction
//This is mimicking the current behavior of
//the SystemResourceManagerImpl registerResource method
//in that, you return the transaction from the TxManager
try {
tran = tm.getTransaction();
} catch (Exception e) {
tran = null;
_logger.log(Level.INFO, e.getMessage());
}
} else {
tran = inv.getTransaction();
tm.unregisterComponentResource(resource);
}
if (tran != null && resource.isEnlisted()) {
tm.delistResource(tran, resource, xaresFlag);
}
}
} catch (SystemException ex) {
_logger.log(Level.WARNING, "poolmgr.system_exception", ex);
} catch (IllegalStateException ex) {
// transaction aborted. Do nothing
} catch (InvocationException ex) {
// unregisterResource is called outside of component context
// likely to be container-forced destroy. Do nothing
}
|