diff options
Diffstat (limited to 'vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py')
-rw-r--r-- | vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py b/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py index 5574f120712..7a5a166733c 100644 --- a/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py @@ -35,6 +35,23 @@ public final class FutureJVppFacadeCallback implements $base_package.$callback_p this.requests = requestMap; } + @Override + public void onError(org.openvpp.jvpp.VppCallbackException reply) { + final java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>> completableFuture; + + synchronized(requests) { + completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(reply.getCtxId()); + } + + if(completableFuture != null) { + completableFuture.completeExceptionally(reply); + + synchronized(requests) { + requests.remove(reply.getCtxId()); + } + } + } + $methods } """) @@ -50,12 +67,7 @@ jvpp_facade_callback_method_template = Template(""" } if(completableFuture != null) { - if(reply.retval < 0) { - completableFuture.completeExceptionally(new Exception("Invocation of " + $base_package.$dto_package.$callback_dto.class - + " failed with value " + reply.retval)); - } else { - completableFuture.complete(reply); - } + completableFuture.complete(reply); synchronized(requests) { requests.remove(reply.context); @@ -84,12 +96,7 @@ jvpp_facade_control_ping_method_template = Template(""" requests.remove((($base_package.$future_package.FutureJVppFacade.CompletableDumpFuture) completableFuture).getContextId()); } } else { - if(reply.retval < 0) { - completableFuture.completeExceptionally(new Exception("Invocation of " + $base_package.$dto_package.$callback_dto.class - + " failed with value " + reply.retval)); - } else { - completableFuture.complete(reply); - } + completableFuture.complete(reply); } synchronized(requests) { |