Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -374,14 +374,10 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
prepareSynchronization(status, definition);
|
||||
return status;
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
catch (RuntimeException | Error ex) {
|
||||
resume(null, suspendedResources);
|
||||
throw ex;
|
||||
}
|
||||
catch (Error err) {
|
||||
resume(null, suspendedResources);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Create "empty" transaction: no actual transaction, but potentially synchronization.
|
||||
@@ -430,14 +426,10 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
prepareSynchronization(status, definition);
|
||||
return status;
|
||||
}
|
||||
catch (RuntimeException beginEx) {
|
||||
catch (RuntimeException | Error beginEx) {
|
||||
resumeAfterBeginException(transaction, suspendedResources, beginEx);
|
||||
throw beginEx;
|
||||
}
|
||||
catch (Error beginErr) {
|
||||
resumeAfterBeginException(transaction, suspendedResources, beginErr);
|
||||
throw beginErr;
|
||||
}
|
||||
}
|
||||
|
||||
if (definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_NESTED) {
|
||||
@@ -589,16 +581,11 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
return new SuspendedResourcesHolder(
|
||||
suspendedResources, suspendedSynchronizations, name, readOnly, isolationLevel, wasActive);
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
catch (RuntimeException | Error ex) {
|
||||
// doSuspend failed - original transaction is still active...
|
||||
doResumeSynchronization(suspendedSynchronizations);
|
||||
throw ex;
|
||||
}
|
||||
catch (Error err) {
|
||||
// doSuspend failed - original transaction is still active...
|
||||
doResumeSynchronization(suspendedSynchronizations);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
else if (transaction != null) {
|
||||
// Transaction active but no synchronization active.
|
||||
@@ -650,14 +637,10 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
try {
|
||||
resume(transaction, suspendedResources);
|
||||
}
|
||||
catch (RuntimeException resumeEx) {
|
||||
catch (RuntimeException | Error resumeEx) {
|
||||
logger.error(exMessage, beginEx);
|
||||
throw resumeEx;
|
||||
}
|
||||
catch (Error resumeErr) {
|
||||
logger.error(exMessage, beginEx);
|
||||
throw resumeErr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -782,20 +765,13 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
catch (RuntimeException | Error ex) {
|
||||
if (!beforeCompletionInvoked) {
|
||||
triggerBeforeCompletion(status);
|
||||
}
|
||||
doRollbackOnCommitException(status, ex);
|
||||
throw ex;
|
||||
}
|
||||
catch (Error err) {
|
||||
if (!beforeCompletionInvoked) {
|
||||
triggerBeforeCompletion(status);
|
||||
}
|
||||
doRollbackOnCommitException(status, err);
|
||||
throw err;
|
||||
}
|
||||
|
||||
// Trigger afterCommit callbacks, with an exception thrown there
|
||||
// propagated to callers but the transaction still considered as committed.
|
||||
@@ -869,14 +845,10 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
logger.debug("Should roll back transaction but cannot - no transaction available");
|
||||
}
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
catch (RuntimeException | Error ex) {
|
||||
triggerAfterCompletion(status, TransactionSynchronization.STATUS_UNKNOWN);
|
||||
throw ex;
|
||||
}
|
||||
catch (Error err) {
|
||||
triggerAfterCompletion(status, TransactionSynchronization.STATUS_UNKNOWN);
|
||||
throw err;
|
||||
}
|
||||
triggerAfterCompletion(status, TransactionSynchronization.STATUS_ROLLED_BACK);
|
||||
}
|
||||
finally {
|
||||
@@ -906,16 +878,11 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
||||
doSetRollbackOnly(status);
|
||||
}
|
||||
}
|
||||
catch (RuntimeException rbex) {
|
||||
catch (RuntimeException | Error rbex) {
|
||||
logger.error("Commit exception overridden by rollback exception", ex);
|
||||
triggerAfterCompletion(status, TransactionSynchronization.STATUS_UNKNOWN);
|
||||
throw rbex;
|
||||
}
|
||||
catch (Error rberr) {
|
||||
logger.error("Commit exception overridden by rollback exception", ex);
|
||||
triggerAfterCompletion(status, TransactionSynchronization.STATUS_UNKNOWN);
|
||||
throw rberr;
|
||||
}
|
||||
triggerAfterCompletion(status, TransactionSynchronization.STATUS_ROLLED_BACK);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user