- // Combine the ready Futures into 1.
- Future<Iterable<ActorSelection>> combinedFutures = akka.dispatch.Futures.sequence(
- previousReadyFutures, getActorContext().getActorSystem().dispatcher());
-
- // Add a callback for completion of the combined Futures.
- final Promise<Object> createTxPromise = akka.dispatch.Futures.promise();
- OnComplete<Iterable<ActorSelection>> onComplete = new OnComplete<Iterable<ActorSelection>>() {
- @Override
- public void onComplete(Throwable failure, Iterable<ActorSelection> notUsed) {
- if(failure != null) {
- // A Ready Future failed so fail the returned Promise.
- createTxPromise.failure(failure);
- } else {
- LOG.debug("Previous Tx readied - sending CreateTransaction for {} on chain {}",
- getIdentifier(), getTransactionChainId());
-
- // Send the CreateTx message and use the resulting Future to complete the
- // returned Promise.
- createTxPromise.completeWith(getActorContext().executeOperationAsync(shard,
- serializedCreateMessage));
- }
- }
- };
+ // Record the we have outstanding futures
+ final State newState = new Submitted(transaction, combined);
+ currentState = newState;