in geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java [222:258]
public synchronized boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, SystemException {
if (!(flag == XAResource.TMFAIL || flag == XAResource.TMSUCCESS || flag == XAResource.TMSUSPEND)) {
throw new IllegalStateException("invalid flag for delistResource: " + flag);
}
if (xaRes == null) {
throw new IllegalArgumentException("XAResource is null");
}
switch (status) {
case Status.STATUS_ACTIVE:
case Status.STATUS_MARKED_ROLLBACK:
break;
default:
throw new IllegalStateException("Status is " + getStateString(status));
}
TransactionBranch manager = activeXaResources.remove(xaRes);
if (manager == null) {
if (flag == XAResource.TMSUSPEND) {
throw new IllegalStateException("trying to suspend an inactive xaresource: " + xaRes);
}
//not active, and we are not trying to suspend. We must be ending tx.
manager = suspendedXaResources.remove(xaRes);
if (manager == null) {
throw new IllegalStateException("Resource not known to transaction: " + xaRes);
}
}
try {
xaRes.end(manager.getBranchId(), flag);
if (flag == XAResource.TMSUSPEND) {
suspendedXaResources.put(xaRes, manager);
}
return true;
} catch (XAException e) {
log.log(Level.WARNING, "Unable to delist XAResource " + xaRes + ", error code: " + e.errorCode, e);
return false;
}
}