aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py')
-rw-r--r--vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py b/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py
index e8de3fc10c1..acf29eb85b8 100644
--- a/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py
+++ b/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py
@@ -77,16 +77,17 @@ $methods
""")
method_template = Template(
- """ void $name($base_package.$dto_package.$request request, $base_package.$callback_package.$callback callback);""")
-method_impl_template = Template(""" public final void $name($base_package.$dto_package.$request request, $base_package.$callback_package.$callback callback) {
+ """ void $name($base_package.$dto_package.$request request, $base_package.$callback_package.$callback callback) throws org.openvpp.jvpp.VppInvocationException;""")
+
+method_impl_template = Template(""" public final void $name($base_package.$dto_package.$request request, $base_package.$callback_package.$callback callback) throws org.openvpp.jvpp.VppInvocationException {
synchronized (callbacks) {
callbacks.put(jvpp.$name(request), callback);
}
}
""")
-no_arg_method_template = Template(""" void $name($base_package.$callback_package.$callback callback);""")
-no_arg_method_impl_template = Template(""" public final void $name($base_package.$callback_package.$callback callback) {
+no_arg_method_template = Template(""" void $name($base_package.$callback_package.$callback callback) throws org.openvpp.jvpp.VppInvocationException;""")
+no_arg_method_impl_template = Template(""" public final void $name($base_package.$callback_package.$callback callback) throws org.openvpp.jvpp.VppInvocationException {
synchronized (callbacks) {
callbacks.put(jvpp.$name(), callback);
}
@@ -172,18 +173,37 @@ jvpp_facade_callback_template = Template("""
package $base_package.$callback_facade_package;
/**
- * <p>JVppGlobalCallback implementation for Java Callback API.
+ * <p>Implementation of JVppGlobalCallback interface for Java Callback API.
* <br>It was generated by jvpp_callback_facade_gen.py based on $inputfile
* <br>(python representation of vpe.api generated by vppapigen).
*/
public final class CallbackJVppFacadeCallback implements $base_package.$callback_package.JVppGlobalCallback {
private final java.util.Map<Integer, $base_package.$callback_package.JVppCallback> requests;
+ private static final java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(CallbackJVppFacadeCallback.class.getName());
public CallbackJVppFacadeCallback(final java.util.Map<Integer, $base_package.$callback_package.JVppCallback> requestMap) {
this.requests = requestMap;
}
+ @Override
+ public void onError(org.openvpp.jvpp.VppCallbackException reply) {
+
+ $base_package.$callback_package.JVppCallback failedCall;
+ synchronized(requests) {
+ failedCall = requests.remove(reply.getCtxId());
+ }
+
+ if(failedCall != null) {
+ try {
+ failedCall.onError(reply);
+ } catch(RuntimeException ex) {
+ ex.addSuppressed(reply);
+ LOG.log(java.util.logging.Level.WARNING, String.format("Callback: %s failed while handling exception: %s", failedCall, reply), ex);
+ }
+ }
+ }
+
$methods
}
""")