|
|
|
@ -261,7 +261,8 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
"Transaction propagation 'nested' not supported for WebSphere UOW transactions"); |
|
|
|
"Transaction propagation 'nested' not supported for WebSphere UOW transactions"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (pb == TransactionDefinition.PROPAGATION_SUPPORTS || |
|
|
|
if (pb == TransactionDefinition.PROPAGATION_SUPPORTS || |
|
|
|
pb == TransactionDefinition.PROPAGATION_REQUIRED || pb == TransactionDefinition.PROPAGATION_MANDATORY) { |
|
|
|
pb == TransactionDefinition.PROPAGATION_REQUIRED || |
|
|
|
|
|
|
|
pb == TransactionDefinition.PROPAGATION_MANDATORY) { |
|
|
|
joinTx = true; |
|
|
|
joinTx = true; |
|
|
|
newSynch = (getTransactionSynchronization() != SYNCHRONIZATION_NEVER); |
|
|
|
newSynch = (getTransactionSynchronization() != SYNCHRONIZATION_NEVER); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -279,7 +280,8 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
"Transaction propagation 'mandatory' but no existing transaction found"); |
|
|
|
"Transaction propagation 'mandatory' but no existing transaction found"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (pb == TransactionDefinition.PROPAGATION_SUPPORTS || |
|
|
|
if (pb == TransactionDefinition.PROPAGATION_SUPPORTS || |
|
|
|
pb == TransactionDefinition.PROPAGATION_NOT_SUPPORTED || pb == TransactionDefinition.PROPAGATION_NEVER) { |
|
|
|
pb == TransactionDefinition.PROPAGATION_NOT_SUPPORTED || |
|
|
|
|
|
|
|
pb == TransactionDefinition.PROPAGATION_NEVER) { |
|
|
|
uowType = UOWSynchronizationRegistry.UOW_TYPE_LOCAL_TRANSACTION; |
|
|
|
uowType = UOWSynchronizationRegistry.UOW_TYPE_LOCAL_TRANSACTION; |
|
|
|
newSynch = (getTransactionSynchronization() == SYNCHRONIZATION_ALWAYS); |
|
|
|
newSynch = (getTransactionSynchronization() == SYNCHRONIZATION_ALWAYS); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -293,6 +295,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
logger.debug("Creating new transaction with name [" + definition.getName() + "]: " + definition); |
|
|
|
logger.debug("Creating new transaction with name [" + definition.getName() + "]: " + definition); |
|
|
|
} |
|
|
|
} |
|
|
|
SuspendedResourcesHolder suspendedResources = (!joinTx ? suspend(null) : null); |
|
|
|
SuspendedResourcesHolder suspendedResources = (!joinTx ? suspend(null) : null); |
|
|
|
|
|
|
|
UOWActionAdapter<T> action = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (definition.getTimeout() > TransactionDefinition.TIMEOUT_DEFAULT) { |
|
|
|
if (definition.getTimeout() > TransactionDefinition.TIMEOUT_DEFAULT) { |
|
|
|
uowManager.setUOWTimeout(uowType, definition.getTimeout()); |
|
|
|
uowManager.setUOWTimeout(uowType, definition.getTimeout()); |
|
|
|
@ -300,7 +303,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
if (debug) { |
|
|
|
if (debug) { |
|
|
|
logger.debug("Invoking WebSphere UOW action: type=" + uowType + ", join=" + joinTx); |
|
|
|
logger.debug("Invoking WebSphere UOW action: type=" + uowType + ", join=" + joinTx); |
|
|
|
} |
|
|
|
} |
|
|
|
UOWActionAdapter<T> action = new UOWActionAdapter<>( |
|
|
|
action = new UOWActionAdapter<>( |
|
|
|
definition, callback, (uowType == UOWManager.UOW_TYPE_GLOBAL_TRANSACTION), !joinTx, newSynch, debug); |
|
|
|
definition, callback, (uowType == UOWManager.UOW_TYPE_GLOBAL_TRANSACTION), !joinTx, newSynch, debug); |
|
|
|
uowManager.runUnderUOW(uowType, joinTx, action); |
|
|
|
uowManager.runUnderUOW(uowType, joinTx, action); |
|
|
|
if (debug) { |
|
|
|
if (debug) { |
|
|
|
@ -308,11 +311,15 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
} |
|
|
|
} |
|
|
|
return action.getResult(); |
|
|
|
return action.getResult(); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (UOWException ex) { |
|
|
|
catch (UOWException | UOWActionException ex) { |
|
|
|
throw new TransactionSystemException("UOWManager transaction processing failed", ex); |
|
|
|
TransactionSystemException tse = |
|
|
|
|
|
|
|
new TransactionSystemException("UOWManager transaction processing failed", ex); |
|
|
|
|
|
|
|
Throwable appEx = action.getException(); |
|
|
|
|
|
|
|
if (appEx != null) { |
|
|
|
|
|
|
|
logger.error("Application exception overridden by rollback exception", appEx); |
|
|
|
|
|
|
|
tse.initApplicationException(appEx); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (UOWActionException ex) { |
|
|
|
throw tse; |
|
|
|
throw new TransactionSystemException("UOWManager threw unexpected UOWActionException", ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
|
if (suspendedResources != null) { |
|
|
|
if (suspendedResources != null) { |
|
|
|
@ -368,12 +375,15 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Throwable ex) { |
|
|
|
catch (Throwable ex) { |
|
|
|
this.exception = ex; |
|
|
|
this.exception = ex; |
|
|
|
|
|
|
|
if (status.isDebug()) { |
|
|
|
|
|
|
|
logger.debug("Rolling back on application exception from transaction callback", ex); |
|
|
|
|
|
|
|
} |
|
|
|
uowManager.setRollbackOnly(); |
|
|
|
uowManager.setRollbackOnly(); |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
|
if (status.isLocalRollbackOnly()) { |
|
|
|
if (status.isLocalRollbackOnly()) { |
|
|
|
if (status.isDebug()) { |
|
|
|
if (status.isDebug()) { |
|
|
|
logger.debug("Transactional code has requested rollback"); |
|
|
|
logger.debug("Transaction callback has explicitly requested rollback"); |
|
|
|
} |
|
|
|
} |
|
|
|
uowManager.setRollbackOnly(); |
|
|
|
uowManager.setRollbackOnly(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -396,6 +406,11 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager |
|
|
|
return this.result; |
|
|
|
return this.result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
|
|
|
public Throwable getException() { |
|
|
|
|
|
|
|
return this.exception; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean isRollbackOnly() { |
|
|
|
public boolean isRollbackOnly() { |
|
|
|
return obtainUOWManager().getRollbackOnly(); |
|
|
|
return obtainUOWManager().getRollbackOnly(); |
|
|
|
|