|
|
|
|
@ -178,10 +178,11 @@ public abstract class DataSourceUtils {
@@ -178,10 +178,11 @@ public abstract class DataSourceUtils {
|
|
|
|
|
|
|
|
|
|
Assert.notNull(con, "No Connection specified"); |
|
|
|
|
|
|
|
|
|
boolean debugEnabled = logger.isDebugEnabled(); |
|
|
|
|
// Set read-only flag.
|
|
|
|
|
if (definition != null && definition.isReadOnly()) { |
|
|
|
|
try { |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
if (debugEnabled) { |
|
|
|
|
logger.debug("Setting JDBC Connection [" + con + "] read-only"); |
|
|
|
|
} |
|
|
|
|
con.setReadOnly(true); |
|
|
|
|
@ -203,7 +204,7 @@ public abstract class DataSourceUtils {
@@ -203,7 +204,7 @@ public abstract class DataSourceUtils {
|
|
|
|
|
// Apply specific isolation level, if any.
|
|
|
|
|
Integer previousIsolationLevel = null; |
|
|
|
|
if (definition != null && definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
if (debugEnabled) { |
|
|
|
|
logger.debug("Changing isolation level of JDBC Connection [" + con + "] to " + |
|
|
|
|
definition.getIsolationLevel()); |
|
|
|
|
} |
|
|
|
|
@ -232,10 +233,11 @@ public abstract class DataSourceUtils {
@@ -232,10 +233,11 @@ public abstract class DataSourceUtils {
|
|
|
|
|
Connection con, @Nullable Integer previousIsolationLevel, boolean resetReadOnly) { |
|
|
|
|
|
|
|
|
|
Assert.notNull(con, "No Connection specified"); |
|
|
|
|
boolean debugEnabled = logger.isDebugEnabled(); |
|
|
|
|
try { |
|
|
|
|
// Reset transaction isolation to previous value, if changed for the transaction.
|
|
|
|
|
if (previousIsolationLevel != null) { |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
if (debugEnabled) { |
|
|
|
|
logger.debug("Resetting isolation level of JDBC Connection [" + |
|
|
|
|
con + "] to " + previousIsolationLevel); |
|
|
|
|
} |
|
|
|
|
@ -244,7 +246,7 @@ public abstract class DataSourceUtils {
@@ -244,7 +246,7 @@ public abstract class DataSourceUtils {
|
|
|
|
|
|
|
|
|
|
// Reset read-only flag if we originally switched it to true on transaction begin.
|
|
|
|
|
if (resetReadOnly) { |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
if (debugEnabled) { |
|
|
|
|
logger.debug("Resetting read-only flag of JDBC Connection [" + con + "]"); |
|
|
|
|
} |
|
|
|
|
con.setReadOnly(false); |
|
|
|
|
|