The supportsDirectCommit method was added for backwards compatibility
with pre-Lithium and thus can be removed to simplify the code. All the
current implementations return true.
Change-Id: I256e19b5c0b63a5371c70def72adc6c2a1427106
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
return cohort.initiateDirectCommit();
}
return cohort.initiateDirectCommit();
}
- @Override
- public boolean supportsDirectCommit() {
- return true;
- }
-
@Override
public void closeTransaction() {
txDelegate.close();
@Override
public void closeTransaction() {
txDelegate.close();
LOG.debug("NoOpTransactionContext {} closeTransaction called", getIdentifier());
}
LOG.debug("NoOpTransactionContext {} closeTransaction called", getIdentifier());
}
- @Override
- public boolean supportsDirectCommit() {
- return true;
- }
-
@Override
public Future<Object> directCommit() {
LOG.debug("Tx {} directCommit called, failure: {}", getIdentifier(), failure);
@Override
public Future<Object> directCommit() {
LOG.debug("Tx {} directCommit called, failure: {}", getIdentifier(), failure);
actorContext.sendOperationAsync(getActor(), new CloseTransaction(getTransactionVersion()).toSerializable());
}
actorContext.sendOperationAsync(getActor(), new CloseTransaction(getTransactionVersion()).toSerializable());
}
- @Override
- public boolean supportsDirectCommit() {
- return true;
- }
-
@Override
public Future<Object> directCommit() {
LOG.debug("Tx {} directCommit called", getIdentifier());
@Override
public Future<Object> directCommit() {
LOG.debug("Tx {} directCommit called", getIdentifier());
<T> void executeRead(AbstractRead<T> readCmd, SettableFuture<T> promise);
<T> void executeRead(AbstractRead<T> readCmd, SettableFuture<T> promise);
- boolean supportsDirectCommit();
-
Future<Object> directCommit();
/**
Future<Object> directCommit();
/**
contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
@Override
public void invoke(TransactionContext transactionContext) {
contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
@Override
public void invoke(TransactionContext transactionContext) {
- promise.completeWith(getReadyOrDirectCommitFuture(transactionContext, operationCallbackRef));
+ promise.completeWith(getDirectCommitFuture(transactionContext, operationCallbackRef));
}
});
future = promise.future();
} else {
// avoid the creation of a promise and a TransactionOperation
}
});
future = promise.future();
} else {
// avoid the creation of a promise and a TransactionOperation
- future = getReadyOrDirectCommitFuture(transactionContext, operationCallbackRef);
+ future = getDirectCommitFuture(transactionContext, operationCallbackRef);
}
return new SingleCommitCohortProxy(txContextFactory.getActorContext(), future, getIdentifier().toString(),
operationCallbackRef);
}
}
return new SingleCommitCohortProxy(txContextFactory.getActorContext(), future, getIdentifier().toString(),
operationCallbackRef);
}
- private Future<?> getReadyOrDirectCommitFuture(TransactionContext transactionContext,
+ private Future<?> getDirectCommitFuture(TransactionContext transactionContext,
OperationCallback.Reference operationCallbackRef) {
OperationCallback.Reference operationCallbackRef) {
- if (transactionContext.supportsDirectCommit()) {
- TransactionRateLimitingCallback rateLimitingCallback = new TransactionRateLimitingCallback(
- txContextFactory.getActorContext());
- operationCallbackRef.set(rateLimitingCallback);
- rateLimitingCallback.run();
- return transactionContext.directCommit();
- } else {
- return transactionContext.readyTransaction();
- }
+ TransactionRateLimitingCallback rateLimitingCallback = new TransactionRateLimitingCallback(
+ txContextFactory.getActorContext());
+ operationCallbackRef.set(rateLimitingCallback);
+ rateLimitingCallback.run();
+ return transactionContext.directCommit();
}
private AbstractThreePhaseCommitCohort<ActorSelection> createMultiCommitCohort(
}
private AbstractThreePhaseCommitCohort<ActorSelection> createMultiCommitCohort(