Use nullOrNonPositive instead of nullOrNonZero 81/48981/2
authorJacky Hu <hudayou@hotmail.com>
Mon, 5 Dec 2016 12:54:26 +0000 (20:54 +0800)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 12 Dec 2016 11:49:46 +0000 (11:49 +0000)
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 <hudayou@hotmail.com>
opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java

index 4b23af1..299f9be 100644 (file)
@@ -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
+}