diff options
Diffstat (limited to 'vpp-api/java/jvpp-registry')
-rw-r--r-- | vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java | 2 | ||||
-rw-r--r-- | vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/test/ConnectionTest.java | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java index ed8b8db804d..98e140e9df6 100644 --- a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java +++ b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java @@ -51,7 +51,7 @@ public abstract class AbstractFutureJVppInvoker implements FutureJVppInvoker { this.requests = Objects.requireNonNull(requestMap, "Null requestMap"); } - protected final Map<Integer, CompletableFuture<? extends JVppReply<?>>> getRequests() { + protected synchronized final Map<Integer, CompletableFuture<? extends JVppReply<?>>> getRequests() { return this.requests; } diff --git a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/test/ConnectionTest.java b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/test/ConnectionTest.java index ea1d8647e56..27b4d29f866 100644 --- a/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/test/ConnectionTest.java +++ b/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/test/ConnectionTest.java @@ -27,14 +27,15 @@ public class ConnectionTest { private static void testConnect() throws Exception { System.out.println("Testing JNI connection with JVppRegistry"); - JVppRegistry registry = new JVppRegistryImpl("ConnectionTest"); - System.out.println("Successfully connected to vpp"); - - Thread.sleep(5000); - - System.out.println("Disconnecting..."); - registry.close(); - Thread.sleep(1000); + final JVppRegistry registry = new JVppRegistryImpl("ConnectionTest"); + try { + System.out.println("Successfully connected to vpp"); + Thread.sleep(5000); + System.out.println("Disconnecting..."); + Thread.sleep(1000); + } finally { + registry.close(); + } } public static void main(String[] args) throws Exception { |