X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fthreadpool-config-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fthreadpool%2Futil%2FFixedThreadPoolWrapper.java;fp=opendaylight%2Fconfig%2Fthreadpool-config-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fthreadpool%2Futil%2FFixedThreadPoolWrapper.java;h=0000000000000000000000000000000000000000;hp=2dad26490bb50f41be0ddc411ce5994f3e861a84;hb=9917911b1a492b5f9fbeef1591569f7fc4a80f68;hpb=77387f3590ca4c42c3ddce52131d5c00d2a3992d diff --git a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java b/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java deleted file mode 100644 index 2dad26490b..0000000000 --- a/opendaylight/config/threadpool-config-impl/src/main/java/org/opendaylight/controller/config/threadpool/util/FixedThreadPoolWrapper.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.config.threadpool.util; - -import java.io.Closeable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import org.opendaylight.controller.config.threadpool.ThreadPool; - -/** - * Implementation of {@link ThreadPool} using fixed number of threads wraps - * {@link ExecutorService}. - */ -public class FixedThreadPoolWrapper implements ThreadPool, Closeable { - - private final ThreadPoolExecutor executor; - - public FixedThreadPoolWrapper(int threadCount, ThreadFactory factory) { - this.executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount, factory); - executor.prestartAllCoreThreads(); - } - - @Override - public ExecutorService getExecutor() { - return Executors.unconfigurableExecutorService(executor); - } - - @Override - public void close() { - executor.shutdown(); - } - - @Override - public int getMaxThreadCount() { - return executor.getMaximumPoolSize(); - } - - public void setMaxThreadCount(int maxThreadCount) { - executor.setCorePoolSize(maxThreadCount); - executor.setMaximumPoolSize(maxThreadCount); - } -}