From 1c3ef198916a5f6f33ab173c35e4a5a53a7bde8b Mon Sep 17 00:00:00 2001 From: Jacky Hu Date: Mon, 5 Dec 2016 20:54:26 +0800 Subject: [PATCH 1/1] 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 --- .../netty/timer/HashedWheelTimerCloseable.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 +} -- 2.36.6