Initialise the thread pool to have the requested number of threads available, life span of threads (set to 0) not used as threads will never be eligible to die as coreSize = maxSize
769851
public void initThreadPool() {
        CustomizableThreadFactory ctf = new CustomizableThreadFactory();
        ctf.setDaemon(true);
        ctf.setThreadNamePrefix(getTransportName()+"-Publisher-");
        threadPool = new JMXReportingThreadPoolExecutor(threadPoolSize, threadPoolSize, 0, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), ctf);
    }
1325544
private synchronized void createSystemThreadPool() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "createSystemThreadPool");
        if (_systemThreadPool == null) {
            // 214163 Add a threadpool listener to associate threads in trace
            // with the messaging engine.
            _systemThreadPool = new ThreadPool(
                            "System " + getMessagingEngineName(),
                            1,
                            _customProperties.get_max_system_threadpool_size(),
                            new ThreadPoolListener[] { new ThreadPoolListenerImpl(this) });
            _systemThreadPool.setRequestBufferExpansionLimit(Integer.MAX_VALUE);

            // note that setting this to true means that the MAX_SYSTEM_THREADS
            // value is ignored
            _systemThreadPool.setGrowAsNeeded(true);
        }
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "createSystemThreadPool");
    }
155379
public static Ctx init(int ioThreads)
    {
        Utils.checkArgument(ioThreads >= 0, "I/O threads must not be negative");
        Ctx ctx = createContext();
        setContextOption(ctx, ZMQ_IO_THREADS, ioThreads);
        return ctx;
    }
1257882
private void init()
	{

		sum = BigInteger.ZERO;
		sumByMillisec = BigInteger.ZERO;
		currentVal = -1;
		count =0;
		avg = -1;
		max = -1;
		min = -1;
	}
404309
def threads_init(gtk=True):
    
    # enable X11 multithreading
    x11.XInitThreads()
    if gtk:
        from gtk.gdk import threads_init
        threads_init()
814255
public void setThreadPoolSize( int threads ) {
		if( threads <= 0 )
			throw new IllegalArgumentException("Number of threads must be greater than 0");
		if( verbose )
			Log.i(TAG,"setThreadPoolSize("+threads+")");

		threadPool.setCorePoolSize(threads);
		threadPool.setMaximumPoolSize(threads);
	}
709483
public void setPoolSize(int poolSize) {
        // Assert.isTrue(poolSize > 0, "'poolSize' must be 1 or higher");
        this.poolSize = poolSize;
        if (this.scheduledExecutor instanceof ScheduledThreadPoolExecutor) {
            ((ScheduledThreadPoolExecutor) this.scheduledExecutor).setCorePoolSize(poolSize);
        }
    }
1065133
public static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize) {
        return new ThreadPoolExecutor(corePoolSize,
            maximumPoolSize,
            DateUtils.MILLISECONDS_PER_MINUTE,
            TimeUnit.MILLISECONDS,
            new SynchronousQueue<Runnable>());
    }
972420
public static QueuedThreadPool createQueuedThreadPool() {
		QueuedThreadPool threadPool = new QueuedThreadPool();

		threadPool.setMinThreads(setting.getInt("min", "threads", 100));
		threadPool.setMaxThreads(setting.getInt("max", "threads", 500));

		return threadPool;
	}
336021
def start(self):
    

    if self.__running:
      raise RuntimeError('ThreadPool already running')
    [t.start() for t in self.__threads]
    self.__running = True
425611
def _prepare_threads(self):
        
        self._threads = []
        for i in range(self.num_workers):
            t = threading.Thread(target=self._fetch)
            t.setDaemon(True)
            t.start()
            self._threads.append(t)
1035124
def set_max_threads(self, max_threads):
        
        if max_threads is None:
            raise TypeError('max_threads must not be None.')
        self._check_if_ready()
        self.collection.set_max_working(max_threads)
341763
def _get_num_parallel_threads(max_threads, num_cores, mem_available_mb):
    '''
    
    '''
    return min(max_threads, num_cores, max(int(mem_available_mb/1200), 1))
891326
public static ExecutorService newMaxQueueThreadPool(int numWorkerThreads,
            long waitingMillis, int maxQueue) {
        return new ThreadPoolExecutor(numWorkerThreads, numWorkerThreads,
                0L, TimeUnit.MILLISECONDS,
                waitingMillis > 0 ? getWaitingLimitedBlockingQueue(
                        waitingMillis, maxQueue) : getLimitedBlockingQueue(
                        maxQueue));
    }
108548
public void collectThreadPool(ServerConfig serverConfig, final ThreadPoolExecutor threadPoolExecutor) {
        try {

            int coreSize = serverConfig.getCoreThreads();
            int maxSize = serverConfig.getMaxThreads();
            int queueSize = serverConfig.getQueues();

            final ThreadPoolConfig threadPoolConfig = new ThreadPoolConfig(coreSize, maxSize, queueSize);

            Lookout.registry().info(rpcLookoutId.fetchServerThreadConfigId(serverConfig), new Info<ThreadPoolConfig>() {

                @Override
                public ThreadPoolConfig value() {
                    return threadPoolConfig;
                }
            });

            Lookout.registry().gauge(rpcLookoutId.fetchServerThreadPoolActiveCountId(serverConfig),
                new Gauge<Integer>() {

                    @Override
                    public Integer value() {
                        return threadPoolExecutor.getActiveCount();
                    }
                });

            Lookout.registry().gauge(rpcLookoutId.fetchServerThreadPoolIdleCountId(serverConfig), new Gauge<Integer>() {

                @Override
                public Integer value() {
                    return threadPoolExecutor.getPoolSize() - threadPoolExecutor.getActiveCount();
                }
            });

            Lookout.registry().gauge(rpcLookoutId.fetchServerThreadPoolQueueSizeId(serverConfig), new Gauge<Integer>() {

                @Override
                public Integer value() {
                    return threadPoolExecutor.getQueue().size();
                }
            });
        } catch (Throwable t) {
            LOGGER.error(LogCodes.getLog(LogCodes.ERROR_METRIC_REPORT_ERROR), t);
        }
    }
1135467
def threaded_start(self, no_init=False):
        '''
        
        '''
        thread = Thread(target=self.init_connections, kwargs={
                        'no_init': no_init})
        thread.setDaemon(True)
        thread.start()
        thread.join()
909873
@SuppressWarnings("unused")
  public static ExecutorService setDefaultThreadPool(ExecutorService threadPool) {
    ExecutorService oldThreadPool = HttpExecutorFactory.threadPool;
    HttpExecutorFactory.threadPool = threadPool;
    return oldThreadPool;
  }