Remove redundant type arguments
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / ExecutorServiceUtil.java
index 836a51a5656b340fd811c85b7ee745d172e371b5..c6a933ab0d2fde82185a0436418430b1413c9664 100644 (file)
@@ -14,6 +14,7 @@ import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import org.eclipse.jdt.annotation.NonNull;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,10 +40,10 @@ public final class ExecutorServiceUtil {
     }
 
     private static final Logger LOG = LoggerFactory.getLogger(ExecutorServiceUtil.class);
-    private static final RejectedExecutionHandler WAIT_IN_QUEUE_HANDLER = new WaitInQueueExecutionHandler();
+    private static final @NonNull RejectedExecutionHandler WAIT_IN_QUEUE_HANDLER = new WaitInQueueExecutionHandler();
 
     private ExecutorServiceUtil() {
-        throw new UnsupportedOperationException("Utility class");
+        // Hidden on purpose
     }
 
     /**
@@ -54,8 +55,8 @@ public final class ExecutorServiceUtil {
      * @param delegate Backing blocking queue.
      * @return A new blocking queue backed by the delegate
      */
-    public static <E> BlockingQueue<E> offerFailingBlockingQueue(final BlockingQueue<E> delegate) {
-        return new ForwardingBlockingQueue<E>() {
+    public static <E> @NonNull BlockingQueue<E> offerFailingBlockingQueue(final BlockingQueue<E> delegate) {
+        return new ForwardingBlockingQueue<>() {
             @Override
             @SuppressWarnings("checkstyle:parameterName")
             public boolean offer(final E o) {
@@ -75,7 +76,7 @@ public final class ExecutorServiceUtil {
      *
      * @return A shared RejectedExecutionHandler instance.
      */
-    public static RejectedExecutionHandler waitInQueueExecutionHandler() {
+    public static @NonNull RejectedExecutionHandler waitInQueueExecutionHandler() {
         return WAIT_IN_QUEUE_HANDLER;
     }
 
@@ -84,8 +85,8 @@ public final class ExecutorServiceUtil {
      * timeout period. If the timeout elapses before termination, the executor is forcefully
      * shutdown.
      */
-    public static void tryGracefulShutdown(final ExecutorService executor, final long timeout, final TimeUnit unit) {
-
+    public static void tryGracefulShutdown(final @NonNull ExecutorService executor, final long timeout,
+            final @NonNull TimeUnit unit) {
         executor.shutdown();
 
         try {