X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fcodegen%2Fimpl%2FSingletonHolder.java;h=bbe5036d791c02559612a245b5d00a3b2ee6a4e6;hp=6bcd74d213526b83c94b43087443e50ba9385da6;hb=refs%2Fchanges%2F78%2F57178%2F2;hpb=d8acce7ba659501f61371eb07a86f391adde87d1 diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java index 6bcd74d213..bbe5036d79 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java @@ -16,15 +16,14 @@ 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; -import javassist.ClassPool; import org.apache.commons.lang3.StringUtils; -import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils; +import org.opendaylight.mdsal.binding.generator.util.JavassistUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javassist.ClassPool; public class SingletonHolder { private static final Logger logger = LoggerFactory.getLogger(SingletonHolder.class); @@ -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); }