aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py
diff options
context:
space:
mode:
authorTibor Sirovatka <tsirovat@cisco.com>2016-05-18 14:54:50 +0200
committerDave Wallace <dwallacelf@gmail.com>2016-06-09 02:22:34 +0000
commit42bb61fd162b3dd469c9d98a9dc6d3e2b2eaffce (patch)
tree133e183e7b02d7d7e01f1ea1353421d8a65ddb2b /vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py
parentb10427e06077dbe3a9ea9922b97941204001f6b9 (diff)
HONEYCOMB-67 Introduce exception handling into JVPP
Send calls throws VppInvocationException on failure Failed requests (negative retval) reported over onError callback interface method Removed retval attributes from dto/xxxReply.java calls Change-Id: Ibd4e90c320d080e02d75b4bd056a7b11c8e37aa7 Signed-off-by: Tibor Sirovatka <tsirovat@cisco.com>
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.py31
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) {