callback.failure(e);
}
// Todo: consider throwing e.
return;
}
RelayOk relayOk = run(commandProcessor, processResult, callback, guard.getRelay());
guard.discharge(relayOk);
}
@Override
public void failure(String message) {
if (callback != null) {
callback.failure(sendStep.processFailure(new Exception(message)));
}
}
};
return commandProcessor.send(sendStep.getParams(), sendCallback, guard.asSyncCallback());
}
@Override
public <RESPONSE> RelayOk visitSend(final SendStepWithResponse<RESPONSE, RES> sendStep) {
final RelaySyncCallback.Guard guard = relaySyncCallback.newGuard();
GenericCallback<RESPONSE> sendCallback = new GenericCallback<RESPONSE>() {
@Override
public void success(RESPONSE response) {
Step<RES> processResult;
try {
processResult = sendStep.processResponse(response);
} catch (ProcessException e) {
if (callback != null) {
callback.failure(e);
}
// Todo: consider throwing e.
return;
}
RelayOk relayOk = run(commandProcessor, processResult, callback, guard.getRelay());
guard.discharge(relayOk);
}
@Override
public void failure(Exception exception) {