From: Robert Varga Date: Wed, 4 Jul 2018 15:28:39 +0000 (+0200) Subject: Fix ScaleUtil warnings X-Git-Tag: release/fluorine~39 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=2828441c67395ea28e638975edd14dfff1969755;p=netconf.git Fix ScaleUtil warnings Callable is a generic type, use it accordingly. Change-Id: I5f947fc4cce9ef4244684013f5980dde439baf64 Signed-off-by: Robert Varga --- diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java index c8929e5132..3f275681aa 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java @@ -196,7 +196,7 @@ public final class ScaleUtil { } } - private static class ScaleVerifyCallable implements Callable { + private static class ScaleVerifyCallable implements Callable { private static final Logger LOG = LoggerFactory.getLogger(ScaleVerifyCallable.class); private static final String RESTCONF_URL @@ -224,7 +224,7 @@ public final class ScaleUtil { } @Override - public Object call() throws Exception { + public Void call() throws Exception { try { final Response response = asyncHttpClient.executeRequest(request).get(); @@ -257,9 +257,9 @@ public final class ScaleUtil { } } - private static class TimeoutGuard implements Callable { + private static class TimeoutGuard implements Callable { @Override - public Object call() throws Exception { + public Void call() throws Exception { resultsLog.warn("Timeout for scale test reached after: {} ..aborting", STOPWATCH); root.warn("Timeout for scale test reached after: {} ..aborting", STOPWATCH); System.exit(0); @@ -275,25 +275,20 @@ public final class ScaleUtil { @Override public ScheduledFuture schedule(Callable callable, long delay, TimeUnit unit) { - return super.schedule(wrapCallable(callable), delay, unit); + return super.schedule(new LogOnExceptionCallable<>(callable), delay, unit); } - private Callable wrapCallable(Callable callable) { - return new LogOnExceptionCallable(callable); - } - - private static class LogOnExceptionCallable implements Callable { - private final Callable theCallable; + private static class LogOnExceptionCallable implements Callable { + private final Callable theCallable; - LogOnExceptionCallable(Callable theCallable) { + LogOnExceptionCallable(Callable theCallable) { this.theCallable = theCallable; } @Override - public Object call() throws Exception { + public T call() throws Exception { try { - theCallable.call(); - return null; + return theCallable.call(); } catch (Exception e) { // log root.warn("error in executing: " + theCallable + ". It will no longer be run!", e);