@Override
public void onFailure(final Throwable throwable) {
+ getMessageSpy().spyMessage(FlowModInput.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_FAILURE);
RpcResultBuilder<T> rpcResultBuilder = RpcResultBuilder.<T>failed().withError(ErrorType.APPLICATION, throwable.getMessage(), throwable);
requestContext.setResult(rpcResultBuilder.build());
mprInput.setMultipartRequestBody(caseBuilder.build());
final OutboundQueue outboundQueue = getDeviceContext().getPrimaryConnectionContext().getOutboundQueueProvider();
- final SettableFuture<RpcResult<List<MultipartReply>>> settableFuture = SettableFuture.create();
final MultiMsgCollector multiMsgCollector = getDeviceContext().getMultiMsgCollector();
multiMsgCollector.registerMultipartRequestContext(requestContext);
}
}
getMessageSpy().spyMessage(multipartRequestInput.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
- settableFuture.set(RpcResultBuilder.<List<MultipartReply>>success().build());
}
@Override
RequestContextUtil.closeRequstContext(requestContext);
multiMsgCollector.registerMultipartRequestContext(requestContext);
getMessageSpy().spyMessage(multipartRequestInput.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_FAILURE);
- settableFuture.set(rpcResultBuilder.build());
}
});
- return settableFuture;
+ return requestContext.getFuture();
}
}
public void onSuccess(final OfHeader ofHeader) {
if (ofHeader instanceof MultipartReply) {
final MultipartReply multipartReply = (MultipartReply) ofHeader;
- requestContext.setResult(RpcResultBuilder.<List<MultipartReply>>success().build());
multiMsgCollector.addMultipartMsg(multipartReply);
} else {
if (null != ofHeader) {
LOG.info("Unexpected response type received {}.", ofHeader.getClass());
+ RpcResultBuilder<List<MultipartReply>> rpcResultBuilder = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.APPLICATION, String.format("Unexpected response type received %s.", ofHeader.getClass()));
+ requestContext.setResult(rpcResultBuilder.build());
} else {
LOG.info("Ofheader was null.");
+ RpcResultBuilder<List<MultipartReply>> rpcResultBuilder = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.APPLICATION, "OfHeader was null");
+ requestContext.setResult(rpcResultBuilder.build());
}
}
}
public void onFailure(final Throwable throwable) {
RpcResultBuilder<List<MultipartReply>> rpcResultBuilder = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.APPLICATION, throwable.getMessage());
requestContext.setResult(rpcResultBuilder.build());
-
RequestContextUtil.closeRequstContext(requestContext);
}
});