Fix coverity issues

Change-Id: I7707a42321df2c73e5414926d4000f8672ecfaf3
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
This commit is contained in:
Marek Gradzki
2016-12-21 14:29:01 +01:00
committed by Damjan Marion
parent 29396e6445
commit 4348c85b3d
2 changed files with 8 additions and 6 deletions

View File

@ -108,12 +108,12 @@ public final class JVppRegistryImpl implements JVppRegistry, ControlPingCallback
final ControlPingCallback callback;
synchronized (pingCalls) {
callback = pingCalls.remove(reply.context);
}
if (callback == null) {
LOG.log(Level.WARNING, "No callback was registered for reply context=" + reply.context + " Contexts waiting="
+ pingCalls.keySet());
return;
}
}
// pass the reply to the callback registered by the ping caller
callback.onControlPingReply(reply);
}

View File

@ -51,8 +51,10 @@ public abstract class AbstractFutureJVppInvoker implements FutureJVppInvoker {
this.requests = Objects.requireNonNull(requestMap, "Null requestMap");
}
protected synchronized final Map<Integer, CompletableFuture<? extends JVppReply<?>>> getRequests() {
return this.requests;
protected final Map<Integer, CompletableFuture<? extends JVppReply<?>>> getRequests() {
synchronized (requests) {
return requests;
}
}
// TODO use Optional in Future, java8