aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java/jvpp-registry
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-10-24 08:06:52 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2016-10-24 10:05:53 +0000
commit9c2964ce01fa05c715499206cf3d0f610c5c334d (patch)
tree19ac7c2bf7ebdad4b2c5b8f6aad84cc3af2a1143 /vpp-api/java/jvpp-registry
parente319de0b0407cd1e0ebc6ad523b9c608499d8c0c (diff)
Fix jvpp coverity issues #2
- synchronize AbstractFutureJvppInvoker.getRequests - handle registry & jvpp close in API usage examples Change-Id: I918bf864b8212fde04f0d9194037f1c6a810fc3f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-api/java/jvpp-registry')
-rw-r--r--vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/AbstractFutureJVppInvoker.java2
-rw-r--r--vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/test/ConnectionTest.java17
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 {