TransactionContextWrapper(final TransactionIdentifier identifier, final ActorContext actorContext) {
this.identifier = Preconditions.checkNotNull(identifier);
this.limiter = new OperationLimiter(identifier,
- actorContext.getDatastoreContext().getShardBatchedModificationCount() + 1, // 1 extra permit for the ready operation
+ // 1 extra permit for the ready operation
+ actorContext.getDatastoreContext().getShardBatchedModificationCount() + 1,
TimeUnit.MILLISECONDS.toSeconds(actorContext.getDatastoreContext().getOperationTimeoutInMillis()));
}
}
void executePriorTransactionOperations(final TransactionContext localTransactionContext) {
- while(true) {
+ while (true) {
// Access to queuedTxOperations and transactionContext must be protected and atomic
// (ie synchronized) with respect to #addTxOperationOnComplete to handle timing
// issues and ensure no TransactionOperation is missed and that they are processed
// in case a TransactionOperation results in another transaction operation being
// queued (eg a put operation from a client read Future callback that is notified
// synchronously).
- Collection<TransactionOperation> operationsBatch = null;
+ final Collection<TransactionOperation> operationsBatch;
synchronized (queuedTxOperations) {
if (queuedTxOperations.isEmpty()) {
// We're done invoking the TransactionOperations so we can now publish the
// TransactionContext.
localTransactionContext.operationHandOffComplete();
- if(!localTransactionContext.usesOperationLimiting()){
+ if (!localTransactionContext.usesOperationLimiting()) {
limiter.releaseAll();
}
transactionContext = localTransactionContext;
final Promise<ActorSelection> promise = Futures.promise();
enqueueTransactionOperation(new TransactionOperation() {
@Override
- public void invoke(TransactionContext transactionContext) {
- promise.completeWith(transactionContext.readyTransaction());
+ public void invoke(TransactionContext newTransactionContext) {
+ promise.completeWith(newTransactionContext.readyTransaction());
}
});