From: Jacky Hu Date: Mon, 5 Dec 2016 12:54:26 +0000 (+0800) Subject: Use nullOrNonPositive instead of nullOrNonZero X-Git-Tag: release/carbon~367 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=1c3ef198916a5f6f33ab173c35e4a5a53a7bde8b Use nullOrNonPositive instead of nullOrNonZero The method name should match it's functionality to test whether the duration is positive or not. Change-Id: I830d1072d5854d88a96f02a3f161456329a50be7 Signed-off-by: Jacky Hu --- diff --git a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java b/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java index 4b23af11a7..299f9be27a 100644 --- a/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java +++ b/opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java @@ -42,24 +42,24 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer { public static HashedWheelTimerCloseable newInstance(@Nullable ThreadFactory threadFactory, @Nullable Long duration, @Nullable Integer ticksPerWheel) { TimeUnit unit = TimeUnit.MILLISECONDS; - if(!nullOrNonZero(duration) && threadFactory == null && nullOrNonZero(ticksPerWheel)) { + if(!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit)); } - if(!nullOrNonZero(duration) && threadFactory == null && !nullOrNonZero(ticksPerWheel)) { + if(!nullOrNonPositive(duration) && threadFactory == null && !nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit, ticksPerWheel)); } - if(nullOrNonZero(duration) && threadFactory != null && nullOrNonZero(ticksPerWheel)) { + if(nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable(new HashedWheelTimer(threadFactory)); } - if(!nullOrNonZero(duration) && threadFactory != null && nullOrNonZero(ticksPerWheel)) { + if(!nullOrNonPositive(duration) && threadFactory != null && nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable( new HashedWheelTimer(threadFactory, duration, unit)); } - if(!nullOrNonZero(duration) && threadFactory != null && !nullOrNonZero(ticksPerWheel)) { + if(!nullOrNonPositive(duration) && threadFactory != null && !nullOrNonPositive(ticksPerWheel)) { return new HashedWheelTimerCloseable( new HashedWheelTimer(threadFactory, duration, unit, ticksPerWheel)); } @@ -67,7 +67,7 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer { return new HashedWheelTimerCloseable(new HashedWheelTimer()); } - private static boolean nullOrNonZero(Number n) { + private static boolean nullOrNonPositive(Number n) { return n == null || n.longValue() <= 0; } -} \ No newline at end of file +}