}
synchronized (lock) {
status.put(taskKey, Status.SUCCESS_RESULT_NOT_SENT);
}
final Map<Number160, Data> outputData2 = outputData;
FutureChannelCreator futureChannelCreator = connectionBean.getConnectionReservation().reserve(1);
futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
@Override
public void operationComplete(final FutureChannelCreator futureChannelCreator) throws Exception {
if (futureChannelCreator.isSuccess()) {
FutureResponse futureResponse = getTaskRPC().sendResult(senderAddress,
futureChannelCreator.getChannelCreator(), taskId, outputData2,
peer.getPeerBean().getKeyPair(), false, sign);
futureResponse.addListener(new BaseFutureAdapter<FutureResponse>() {
@Override
public void operationComplete(FutureResponse future) throws Exception {
if (future.isSuccess()) {
synchronized (lock) {
status.put(taskKey, Status.SUCCESS_RESULT_SENT);
}
} else {
registerException(taskKey, "could not send result back");
}
connectionBean.getConnectionReservation().release(
futureChannelCreator.getChannelCreator());
}
});
} else {
registerException(taskKey, "could not reserve connection");
}