- return readyReplyFuture.transform(new Mapper<Object, ActorSelection>() {
- @Override
- public ActorSelection checkedApply(Object serializedReadyReply) {
- LOG.debug("Tx {} readyTransaction", getIdentifier());
-
- // At this point the ready operation succeeded and we need to extract the cohort
- // actor path from the reply.
- if(ReadyTransactionReply.isSerializedType(serializedReadyReply)) {
- ReadyTransactionReply readyTxReply = ReadyTransactionReply.fromSerializable(serializedReadyReply);
- return actorContext.actorSelection(extractCohortPathFrom(readyTxReply));
- }
-
- // Throwing an exception here will fail the Future.
- throw new IllegalArgumentException(String.format("%s: Invalid reply type %s",
- getIdentifier(), serializedReadyReply.getClass()));
- }
- }, TransactionProxy.SAME_FAILURE_TRANSFORMER, actorContext.getClientDispatcher());
- }
-
- protected String extractCohortPathFrom(ReadyTransactionReply readyTxReply) {
- return readyTxReply.getCohortPath();