aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-08-15 12:25:24 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-08-16 01:31:00 +0000
commit5da27c260e538188b0b934f55db98dc29ff4a24a (patch)
treee31c77de62df830044afd182f5da6bb3e3dbf440
parent24b170aac55d16cb3ff934d2f3d7983dc11cbe12 (diff)
jvpp: move JVppReply's id out of synchronized block
Should make Coverity stop thinking we try to synchronize reply.context. Change-Id: I97169e46b9c8f594836d6beb75b9f42dfc6e5bad Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py10
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py22
2 files changed, 17 insertions, 15 deletions
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 ac096a71..9aaa4c64 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
@@ -222,11 +222,12 @@ public final class CallbackJVpp${plugin_name}FacadeCallback implements $plugin_p
@Override
@SuppressWarnings("unchecked")
- public void onControlPingReply($base_package.$dto_package.ControlPingReply reply) {
+ public void onControlPingReply(final $base_package.$dto_package.ControlPingReply reply) {
$base_package.$callback_package.ControlPingCallback callback;
+ final int replyId = reply.context;
synchronized(requests) {
- callback = ($base_package.$callback_package.ControlPingCallback) requests.remove(reply.context);
+ callback = ($base_package.$callback_package.ControlPingCallback) requests.remove(replyId);
}
if(callback != null) {
@@ -241,11 +242,12 @@ $methods
jvpp_facade_callback_method_template = Template("""
@Override
@SuppressWarnings("unchecked")
- public void on$callback_dto($plugin_package.$dto_package.$callback_dto reply) {
+ public void on$callback_dto(final $plugin_package.$dto_package.$callback_dto reply) {
$plugin_package.$callback_package.$callback callback;
+ final int replyId = reply.context;
synchronized(requests) {
- callback = ($plugin_package.$callback_package.$callback) requests.remove(reply.context);
+ callback = ($plugin_package.$callback_package.$callback) requests.remove(replyId);
}
if(callback != null) {
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 26b31e22..07947e30 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
@@ -59,11 +59,12 @@ public final class FutureJVpp${plugin_name}FacadeCallback implements $plugin_pac
@Override
@SuppressWarnings("unchecked")
- public void onControlPingReply($base_package.$dto_package.ControlPingReply reply) {
+ public void onControlPingReply(final $base_package.$dto_package.ControlPingReply reply) {
final java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>> completableFuture;
+ final int replyId = reply.context;
synchronized(requests) {
- completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(reply.context);
+ completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(replyId);
}
if(completableFuture != null) {
@@ -77,9 +78,8 @@ public final class FutureJVpp${plugin_name}FacadeCallback implements $plugin_pac
} else {
completableFuture.complete(reply);
}
-
synchronized(requests) {
- requests.remove(reply.context);
+ requests.remove(replyId);
}
}
}
@@ -91,18 +91,18 @@ $methods
jvpp_facade_callback_method_template = Template("""
@Override
@SuppressWarnings("unchecked")
- public void on$callback_dto($plugin_package.$dto_package.$callback_dto reply) {
+ 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;
synchronized(requests) {
- completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(reply.context);
+ completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(replyId);
}
if(completableFuture != null) {
completableFuture.complete(reply);
synchronized(requests) {
- requests.remove(reply.context);
+ requests.remove(replyId);
}
}
}
@@ -118,11 +118,11 @@ jvpp_facade_callback_notification_method_template = Template("""
jvpp_facade_details_callback_method_template = Template("""
@Override
@SuppressWarnings("unchecked")
- public void on$callback_dto($plugin_package.$dto_package.$callback_dto reply) {
+ 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;
synchronized(requests) {
- completableFuture = ($base_package.$future_package.AbstractFutureJVppInvoker.CompletableDumpFuture<$plugin_package.$dto_package.$callback_dto_reply_dump>) requests.get(reply.context);
+ completableFuture = ($base_package.$future_package.AbstractFutureJVppInvoker.CompletableDumpFuture<$plugin_package.$dto_package.$callback_dto_reply_dump>) requests.get(replyId);
}
if(completableFuture != null) {