Integrate MRI projects for Neon
[controller.git] / opendaylight / config / netty-timer-config / src / main / java / org / opendaylight / controller / config / yang / netty / timer / HashedWheelTimerCloseable.java
index 299f9be27aa5b830cb9758e405f0273a0a5f95b5..de187bbe9b88cb3214478f71f66c2aaff5e8b5b2 100644 (file)
@@ -20,17 +20,17 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer {
 
     private final Timer timer;
 
-    private HashedWheelTimerCloseable(Timer timer) {
+    private HashedWheelTimerCloseable(final Timer timer) {
         this.timer = timer;
     }
 
     @Override
-    public void close() throws Exception {
+    public void close() {
         stop();
     }
 
     @Override
-    public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {
+    public Timeout newTimeout(final TimerTask task, final long delay, final TimeUnit unit) {
         return this.timer.newTimeout(task, delay, unit);
     }
 
@@ -39,8 +39,13 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer {
         return this.timer.stop();
     }
 
-    public static HashedWheelTimerCloseable newInstance(@Nullable ThreadFactory threadFactory,
-            @Nullable Long duration, @Nullable Integer ticksPerWheel) {
+    public static HashedWheelTimerCloseable newInstance(@Nullable final Long duration,
+            @Nullable final Integer ticksPerWheel) {
+        return newInstance(null, duration, ticksPerWheel);
+    }
+
+    public static HashedWheelTimerCloseable newInstance(@Nullable final ThreadFactory threadFactory,
+            @Nullable final Long duration, @Nullable final Integer ticksPerWheel) {
         TimeUnit unit = TimeUnit.MILLISECONDS;
         if(!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) {
             return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit));
@@ -67,7 +72,7 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer {
         return new HashedWheelTimerCloseable(new HashedWheelTimer());
     }
 
-    private static boolean nullOrNonPositive(Number n) {
+    private static boolean nullOrNonPositive(final Number n) {
         return n == null || n.longValue() <= 0;
     }
 }