Skip to content

Commit

Permalink
#374 - Add DbOffline check into TransactionManager isReadCommittedIso…
Browse files Browse the repository at this point in the history
…lation()
  • Loading branch information
rbygrave committed Aug 14, 2015
1 parent 5166fbe commit 60c1a5b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.avaje.ebean.config.PersistBatch;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.config.dbplatform.DatabasePlatform.OnQueryOnly;
import com.avaje.ebean.dbmigration.DbOffline;
import com.avaje.ebean.event.TransactionEventListener;
import com.avaje.ebeaninternal.api.SpiTransaction;
import com.avaje.ebeaninternal.api.TransactionEvent;
Expand Down Expand Up @@ -157,7 +158,7 @@ private OnQueryOnly initOnQueryOnly(OnQueryOnly dbPlatformOnQueryOnly, DataSourc

if (OnQueryOnly.CLOSE.equals(dbPlatformOnQueryOnly)) {
// check for read committed isolation level
if (!isReadCommitedIsolation(ds)) {
if (!isReadCommittedIsolation(ds)) {
logger.warn("Ignoring DatabasePlatform.OnQueryOnly.CLOSE as the transaction Isolation Level is not " +
"READ_COMMITTED");
// we will just use ROLLBACK and ignore the desired optimisation
Expand All @@ -174,8 +175,11 @@ private OnQueryOnly initOnQueryOnly(OnQueryOnly dbPlatformOnQueryOnly, DataSourc
/**
* Return true if the isolation level is read committed.
*/
private boolean isReadCommitedIsolation(DataSource ds) {
private boolean isReadCommittedIsolation(DataSource ds) {

if (DbOffline.isSet()) {
return true;
}
Connection c = null;
try {
c = ds.getConnection();
Expand Down

0 comments on commit 60c1a5b

Please sign in to comment.