+ public void onSuccess(List<RpcResult<T>> results) {
+ List<RpcError> rpcErrorLot = new ArrayList<>();
+ RpcResultBuilder<T> resultBuilder;
+
+ Iterator<FlowModInputBuilder> flowModInputBldIterator = ofFlowModInputs.iterator();
+ Iterator<RpcResult<T>> resultIterator = results.iterator();
+
+ for (ListenableFuture<RpcResult<T>> partFutureFromRqCtx : partialFutures) {
+ FlowModInputBuilder flowModInputBld = flowModInputBldIterator.next();
+ RpcResult<T> result = resultIterator.next();
+ Long xid = flowModInputBld.getXid();
+
+
+ LOG.trace("flowMod future processing [{}], result={}", xid, result);
+ if (partFutureFromRqCtx.isCancelled()) { // one and only positive case
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("flow future result was cancelled [{}] = barrier passed it without error", xid);
+ }
+ } else { // all negative cases
+ if (result == null) { // there is exception or null value set
+ try {
+ partFutureFromRqCtx.get();
+ } catch (Exception e) {
+ rpcErrorLot.add(RpcResultBuilder.newError(ErrorType.APPLICATION, "",
+ "flow future result [" + xid + "] failed with exception",
+ OFConstants.APPLICATION_TAG, e.getMessage(), e));
+
+ // xid might be not available in case requestContext not even stored
+ if (xid != null) {
+ deviceContext.unhookRequestCtx(new Xid(xid));
+ }
+ }
+ } else {
+ if (result.isSuccessful()) { // positive confirmation - never happens
+ LOG.warn("Positive confirmation of flow push is not supported by OF-spec");
+ LOG.warn("flow future result was successful [{}] = this should have never happen",
+ xid);
+ rpcErrorLot.add(RpcResultBuilder.newError(ErrorType.APPLICATION, "",
+ "flow future result was successful [" + xid + "] = this should have never happen"));
+ } else { // standard error occurred
+ LOG.trace("passing original rpcErrors [{}]", xid);
+ if (LOG.isTraceEnabled()) {
+ for (RpcError rpcError : result.getErrors()) {
+ LOG.trace("passed rpcError [{}]: {}", xid, rpcError);
+ }
+ }
+ rpcErrorLot.addAll(result.getErrors());
+ }
+ }