$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;
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.
$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);
}
@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);
}
""")
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,
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);
}
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);
}
""")
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);
}
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;
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);
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);
// 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
@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