Address trivial eclipse warnings
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / concurrent / AsyncNotifyingListenableFutureTask.java
index 2ba16931f18a8f687836415c8da213e2a6cc3bab..53629b033055c47f9d84018c240888e2226df7fd 100644 (file)
@@ -12,14 +12,11 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.ExecutionList;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListenableFutureTask;
-
 import java.util.concurrent.Callable;
 import java.util.concurrent.Executor;
 import java.util.concurrent.FutureTask;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -32,13 +29,13 @@ import org.slf4j.LoggerFactory;
  * to avoid blocking the thread that completed this task, as a common use case is to pass an
  * executor that runs tasks in the same thread as the caller (ie MoreExecutors#sameThreadExecutor)
  * to {@link #addListener}.
- * <p>
- * Note: the Executor specified on construction does not replace the Executor specified in
+ *
+ * <p>Note: the Executor specified on construction does not replace the Executor specified in
  * {@link #addListener}. The latter Executor is still used however, if it is detected that the
  * listener Runnable would execute in the thread that completed this task, the listener
  * is executed on Executor specified on construction.
  *
- * Also note that the use of this task may attach some (small) amount of state to the threads
+ * <p>Also note that the use of this task may attach some (small) amount of state to the threads
  * interacting with it. That state will not be detached automatically, but you can use
  *  {@link #cleanStateForCurrentThread()} to clean it up.
  *
@@ -48,13 +45,17 @@ import org.slf4j.LoggerFactory;
  * @param <V> the Future result value type
  */
 public class AsyncNotifyingListenableFutureTask<V> extends FutureTask<V> implements ListenableFuture<V> {
-    private static final class DelegatingAsyncNotifyingListenableFutureTask<V> extends AsyncNotifyingListenableFutureTask<V> {
+
+    private static final class DelegatingAsyncNotifyingListenableFutureTask<V>
+            extends AsyncNotifyingListenableFutureTask<V> {
+
         /**
          * The executor used to run listener callbacks.
          */
         private final Executor listenerExecutor;
 
-        private DelegatingAsyncNotifyingListenableFutureTask(final Callable<V> callable, @Nullable final Executor listenerExecutor) {
+        private DelegatingAsyncNotifyingListenableFutureTask(final Callable<V> callable,
+                @Nullable final Executor listenerExecutor) {
             super(callable);
             this.listenerExecutor = Preconditions.checkNotNull(listenerExecutor);
         }
@@ -135,11 +136,10 @@ public class AsyncNotifyingListenableFutureTask<V> extends FutureTask<V> impleme
      */
     public static <V> AsyncNotifyingListenableFutureTask<V> create(final Callable<V> callable,
             @Nullable final Executor listenerExecutor) {
-        if (listenerExecutor != null) {
-            return new DelegatingAsyncNotifyingListenableFutureTask<V>(callable, listenerExecutor);
-        } else {
-            return new AsyncNotifyingListenableFutureTask<V>(callable);
+        if (listenerExecutor == null) {
+            return new AsyncNotifyingListenableFutureTask<>(callable);
         }
+        return new DelegatingAsyncNotifyingListenableFutureTask<>(callable, listenerExecutor);
     }
 
     /**
@@ -154,11 +154,10 @@ public class AsyncNotifyingListenableFutureTask<V> extends FutureTask<V> impleme
      */
     public static <V> AsyncNotifyingListenableFutureTask<V> create(final Runnable runnable, @Nullable final V result,
             @Nullable final Executor listenerExecutor) {
-        if (listenerExecutor != null) {
-            return new DelegatingAsyncNotifyingListenableFutureTask<V>(runnable, result, listenerExecutor);
-        } else {
-            return new AsyncNotifyingListenableFutureTask<V>(runnable, result);
+        if (listenerExecutor == null) {
+            return new AsyncNotifyingListenableFutureTask<>(runnable, result);
         }
+        return new DelegatingAsyncNotifyingListenableFutureTask<>(runnable, result, listenerExecutor);
     }
 
     @Override