diff options
author | Matej Perina <mperina@cisco.com> | 2017-09-25 09:42:42 +0200 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-10-03 11:04:18 +0000 |
commit | b4d3c96f89bb832203092dcc94eeaa11a906594c (patch) | |
tree | 7573e81069e4c8b1eef481a74f07340ae32de5ae | |
parent | 59b2565cd91a67ced650739f36129650830211ac (diff) |
jvpp: added logs for sending and receiving event messages (VPP-982)
Change-Id: I47f9d12d934378f18c6f841b902af2a64ee7b187
Signed-off-by: Matej Perina <mperina@cisco.com>
5 files changed, 30 insertions, 0 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py index 8761eb136c2..4fe7ab53fb9 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py @@ -140,6 +140,8 @@ JNIEXPORT jint JNICALL Java_io_fd_vpp_jvpp_${plugin_name}_JVpp${java_plugin_name $msg_initialization // send message: + if (CLIB_DEBUG > 1) + clib_warning ("Sending ${field_name} event message"); vl_msg_api_send_shmem (plugin_main->vl_input_queue, (u8 *)&mp); if ((*env)->ExceptionCheck(env)) { return JNI_ERR; @@ -229,6 +231,9 @@ static void vl_api_${handler_name}_t_handler (vl_api_${handler_name}_t * mp) jthrowable exc; $err_handler + if (CLIB_DEBUG > 1) + clib_warning ("Received ${handler_name} event message"); + jmethodID constructor = (*env)->GetMethodID(env, ${class_ref_name}Class, "<init>", "()V"); // User does not have to provide callbacks for all VPP messages. diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py index 9aaa4c645f0..3cfc633a55c 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py @@ -246,6 +246,9 @@ jvpp_facade_callback_method_template = Template(""" $plugin_package.$callback_package.$callback callback; final int replyId = reply.context; + if (LOG.isLoggable(java.util.logging.Level.FINE)) { + LOG.fine(String.format("Received $callback_dto event message: %s", reply)); + } synchronized(requests) { callback = ($plugin_package.$callback_package.$callback) requests.remove(replyId); } @@ -260,6 +263,9 @@ jvpp_facade_callback_notification_method_template = Template(""" @Override @SuppressWarnings("unchecked") public void on$callback_dto($plugin_package.$dto_package.$callback_dto notification) { + if (LOG.isLoggable(java.util.logging.Level.FINE)) { + LOG.fine(String.format("Received $callback_dto event message: %s", notification)); + } notificationCallback.on$callback_dto(notification); } """) diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py index 07947e30673..b2f8d376aca 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py @@ -31,6 +31,7 @@ public final class FutureJVpp${plugin_name}FacadeCallback implements $plugin_pac private final java.util.Map<java.lang.Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requests; private final $plugin_package.$notification_package.Global${plugin_name}NotificationCallback notificationCallback; + private static final java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(FutureJVpp${plugin_name}FacadeCallback.class.getName()); public FutureJVpp${plugin_name}FacadeCallback( final java.util.Map<java.lang.Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requestMap, @@ -94,6 +95,9 @@ jvpp_facade_callback_method_template = Template(""" public void on$callback_dto(final $plugin_package.$dto_package.$callback_dto reply) { final java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>> completableFuture; final int replyId = reply.context; + if (LOG.isLoggable(java.util.logging.Level.FINE)) { + LOG.fine(String.format("Received $callback_dto event message: %s", reply)); + } synchronized(requests) { completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(replyId); } @@ -111,6 +115,9 @@ jvpp_facade_callback_method_template = Template(""" jvpp_facade_callback_notification_method_template = Template(""" @Override public void on$callback_dto($plugin_package.$dto_package.$callback_dto notification) { + if (LOG.isLoggable(java.util.logging.Level.FINE)) { + LOG.fine(String.format("Received $callback_dto event message: %s", notification)); + } notificationCallback.on$callback_dto(notification); } """) @@ -121,6 +128,9 @@ jvpp_facade_details_callback_method_template = Template(""" public void on$callback_dto(final $plugin_package.$dto_package.$callback_dto reply) { final $base_package.$future_package.AbstractFutureJVppInvoker.CompletableDumpFuture<$plugin_package.$dto_package.$callback_dto_reply_dump> completableFuture; final int replyId = reply.context; + if (LOG.isLoggable(java.util.logging.Level.FINE)) { + LOG.fine(String.format("Received $callback_dto event message: %s", reply)); + } synchronized(requests) { completableFuture = ($base_package.$future_package.AbstractFutureJVppInvoker.CompletableDumpFuture<$plugin_package.$dto_package.$callback_dto_reply_dump>) requests.get(replyId); } diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py index 7bf911384de..7af70be0df9 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py @@ -49,6 +49,7 @@ import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.Set; import java.util.logging.Logger; +import java.util.logging.Level; import $base_package.callback.JVppCallback; import $base_package.VppConnection; import $base_package.JVppRegistry; @@ -139,6 +140,9 @@ method_native_template = Template( method_impl_template = Template(""" public final int $name($plugin_package.$dto_package.$request request) throws io.fd.vpp.jvpp.VppInvocationException { java.util.Objects.requireNonNull(request,"Null request object"); connection.checkActive(); + if(LOG.isLoggable(Level.FINE)) { + LOG.fine(String.format("Sending $name event message: %s", request)); + } int result=${name}0(request); if(result<0){ throw new io.fd.vpp.jvpp.VppInvocationException("${name}",result); @@ -151,6 +155,7 @@ no_arg_method_template = Template(""" int $name() throws io.fd.vpp.jvpp.VppIn no_arg_method_native_template = Template(""" private static native int ${name}0() throws io.fd.vpp.jvpp.VppInvocationException;""") no_arg_method_impl_template = Template(""" public final int $name() throws io.fd.vpp.jvpp.VppInvocationException { connection.checkActive(); + LOG.fine("Sending $name event message"); int result=${name}0(); if(result<0){ throw new io.fd.vpp.jvpp.VppInvocationException("${name}",result); diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py index 94302d56708..66de7a56ed1 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py @@ -62,6 +62,7 @@ public final class ${plugin_name}NotificationRegistryImpl implements ${plugin_na // TODO add a special NotificationCallback interface and only allow those to be registered private final java.util.concurrent.ConcurrentMap<Class<? extends $base_package.$dto_package.JVppNotification>, $base_package.$callback_package.JVppNotificationCallback> registeredCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); + private static java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(${plugin_name}NotificationRegistryImpl.class.getName()); $register_callback_methods $handler_methods @@ -87,6 +88,9 @@ handler_impl_template = Template(""" @Override public void on$notification( final $plugin_package.$dto_package.$notification notification) { + if (LOG.isLoggable(java.util.logging.Level.FINE)) { + LOG.fine(String.format("Received $notification event message: %s", notification)); + } final $base_package.$callback_package.JVppNotificationCallback jVppNotificationCallback = registeredCallbacks.get($plugin_package.$dto_package.$notification.class); if (null != jVppNotificationCallback) { (($plugin_package.$callback_package.$callback) registeredCallbacks |