diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-10-24 08:06:52 +0200 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-10-24 10:05:53 +0000 |
commit | 9c2964ce01fa05c715499206cf3d0f610c5c334d (patch) | |
tree | 19ac7c2bf7ebdad4b2c5b8f6aad84cc3af2a1143 /plugins | |
parent | e319de0b0407cd1e0ebc6ad523b9c608499d8c0c (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 'plugins')
-rw-r--r-- | plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java b/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java index fd462bda7c6..e168d0560e7 100644 --- a/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java +++ b/plugins/snat-plugin/snat/jvpp/io/fd/vpp/jvpp/snat/test/CallbackApiTest.java @@ -48,23 +48,22 @@ public class CallbackApiTest { private static void testCallbackApi() throws Exception { System.out.println("Testing Java callback API for snat plugin"); - JVppRegistry registry = new JVppRegistryImpl("SnatCallbackApiTest"); - JVpp jvpp = new JVppSnatImpl(); + try (final JVppRegistry registry = new JVppRegistryImpl("SnatCallbackApiTest"); + final JVpp jvpp = new JVppSnatImpl()) { + registry.register(jvpp, new TestCallback()); - registry.register(jvpp, new TestCallback()); + System.out.println("Sending SnatInterfaceAddDelFeature request..."); + SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature(); + request.isAdd = 1; + request.isInside = 1; + request.swIfIndex = 1; + final int result = jvpp.send(request); + System.out.printf("SnatInterfaceAddDelFeature send result = %d%n", result); - System.out.println("Sending SnatInterfaceAddDelFeature request..."); - SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature(); - request.isAdd = 1; - request.isInside = 1; - request.swIfIndex = 1; - final int result = jvpp.send(request); - System.out.printf("SnatInterfaceAddDelFeature send result = %d%n", result); + Thread.sleep(1000); - Thread.sleep(1000); - - System.out.println("Disconnecting..."); - registry.close(); + System.out.println("Disconnecting..."); + } Thread.sleep(1000); } } |