sal-binding-broker: use lambdas
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / codegen / impl / SingletonHolder.java
index 2ca3530a74f3d3594c00a1d6f345c03d4a29f57b..bbe5036d791c02559612a245b5d00a3b2ee6a4e6 100644 (file)
@@ -16,7 +16,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
@@ -89,17 +88,14 @@ public class SingletonHolder {
 
             final ThreadPoolExecutor executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS, MAX_NOTIFICATION_THREADS,
                     NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, queue, factory,
-                    new RejectedExecutionHandler() {
-                // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
-                @Override
-                public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
-                    try {
-                        executor.getQueue().put(r);
-                    } catch (final InterruptedException e) {
-                        throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
-                    }
-                }
-            });
+                    // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
+                    (r, executor1) -> {
+                        try {
+                            executor1.getQueue().put(r);
+                        } catch (final InterruptedException e) {
+                            throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
+                        }
+                    });
 
             NOTIFICATION_EXECUTOR = MoreExecutors.listeningDecorator(executor);
         }