Add API version protection for the change to use a default option for used during commit protection in Java
This commit is contained in:
parent
64a6ab7122
commit
95cf9948a1
|
@ -45,7 +45,9 @@ class FDBDatabase extends NativeObjectWrapper implements Database, OptionConsume
|
|||
// Automatically set the UsedDuringCommitProtectionDisable option
|
||||
// This is because the Java bindings disallow use of Transaction objects after
|
||||
// Transaction#onError is called.
|
||||
this.options.setTransactionUsedDuringCommitProtectionDisable();
|
||||
if (FDB.instance().getAPIVersion() >= 730) {
|
||||
this.options.setTransactionUsedDuringCommitProtectionDisable();
|
||||
}
|
||||
this.eventKeeper = eventKeeper;
|
||||
}
|
||||
|
||||
|
@ -170,6 +172,10 @@ class FDBDatabase extends NativeObjectWrapper implements Database, OptionConsume
|
|||
Transaction tr = null;
|
||||
try {
|
||||
tr = new FDBTransaction(Database_createTransaction(getPtr()), this, e, eventKeeper);
|
||||
// In newer versions, this option is set as a default option on the database
|
||||
if (FDB.instance().getAPIVersion() < 730) {
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
}
|
||||
return tr;
|
||||
} catch (RuntimeException err) {
|
||||
if (tr != null) {
|
||||
|
|
|
@ -127,6 +127,10 @@ class FDBTenant extends NativeObjectWrapper implements Tenant {
|
|||
Transaction tr = null;
|
||||
try {
|
||||
tr = new FDBTransaction(Tenant_createTransaction(getPtr()), database, e, eventKeeper);
|
||||
// In newer versions, this option is set as a default option on the database
|
||||
if (FDB.instance().getAPIVersion() < 730) {
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
}
|
||||
return tr;
|
||||
} catch (RuntimeException err) {
|
||||
if (tr != null) {
|
||||
|
|
|
@ -766,6 +766,10 @@ class FDBTransaction extends NativeObjectWrapper implements Transaction, OptionC
|
|||
FDBTransaction tr = null;
|
||||
try {
|
||||
tr = new FDBTransaction(getPtr(), database, executor);
|
||||
// In newer versions, this option is set as a default option on the database
|
||||
if (FDB.instance().getAPIVersion() < 730) {
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
}
|
||||
transactionOwner = false;
|
||||
return tr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue