Sets the minimum free thread count.

@param pMaxConcurrentThreadCount
11427
public void setMaxConcurrentThreadCount(String pMaxConcurrentThreadCount) {
        if (!StringUtil.isEmpty(pMaxConcurrentThreadCount)) {
            try {
                maxConcurrentThreadCount = Integer.parseInt(pMaxConcurrentThreadCount);
            }
            catch (NumberFormatException nfe) {
                // Use default
            }
        }
    }
463153
public ClientFlakeIdGeneratorConfig setPrefetchCount(int prefetchCount) {
        checkTrue(prefetchCount > 0 && prefetchCount <= MAXIMUM_PREFETCH_COUNT,
                "prefetch-count must be 1.." + MAXIMUM_PREFETCH_COUNT + ", not " + prefetchCount);
        this.prefetchCount = prefetchCount;
        return this;
    }
871842
@Override
    public final void setReplyPriority(int value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setReplyPriority", Integer.valueOf(value));
        if ((value >= MfpConstants.MIN_PRIORITY) && (value <= MfpConstants.MAX_PRIORITY)) {
            getApi().setIntField(JsApiAccess.REPLYPRIORITY_VALUE, value);
        }
        else {
            IllegalArgumentException e = new IllegalArgumentException(Integer.toString(value));
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "setReplyPriority", e);
            throw e;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setReplyPriority");
    }
1122790
protected void stopProxy() throws Exception {
    mProxyProcess.stop();
    if (mProxyThread != null) {
      while (mProxyThread.isAlive()) {
        LOG.info("Stopping thread {}.", mProxyThread.getName());
        mProxyThread.interrupt();
        mProxyThread.join(1000);
      }
      mProxyThread = null;
    }
  }
1161011
public double getElapsedTimeCurrentThread(int stage) {
	   if (stage == ProfilingEvent.START.ordinal()) {
           return 0;    
	   }
	   
	   Accumulator acc = getAccForThread();

	   return acc == null ? Double.NaN : (acc.currentTimes[stage] - acc.currentTimes[stage - 1]) / MILLION;
   }
609115
public void setThreadCount(int thread) {
		this.threadCount = thread;
		getConfig().setProperty(SPIDER_THREAD, Integer.toString(this.threadCount));
	}
1348786
def set_thread(self, thread = None):
        
        if thread is None:
            self.__thread = None
        else:
            self.__load_Thread_class()
            if not isinstance(thread, Thread):
                msg  = "Parent thread must be a Thread instance, "
                msg += "got %s instead" % type(thread)
                raise TypeError(msg)
            self.dwThreadId = thread.get_tid()
            self.__thread = thread
909873
@SuppressWarnings("unused")
  public static ExecutorService setDefaultThreadPool(ExecutorService threadPool) {
    ExecutorService oldThreadPool = HttpExecutorFactory.threadPool;
    HttpExecutorFactory.threadPool = threadPool;
    return oldThreadPool;
  }
876804
private void incrementThreadLockCount()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "incrementThreadLockCount", this);
    //get the current thread
    Thread currentThread = Thread.currentThread();
    //get it's current read lock count
    LockCount count = (LockCount) readerThreads.get(currentThread);
    //if it doesn't exist, create it
    if(count == null)
    {
      count = new LockCount();
      readerThreads.put(currentThread, count);
    }
    //increment the count
    if(count.count == 0) readerThreadCount++;
    count.count++;
    readLockCount++;
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "incrementThreadLockCount");
  }
98516
private synchronized void createReconstituteThreadPool()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createReconstituteThreadPool");

        if (_reconstituteThreadpool == null)
        {
            int maxThreadPoolSize;

            if (messageProcessor.getMessagingEngine().datastoreExists()) {
                //data store. Proceed and calcualte number of threads to use for reconstitution

                //get the thread pool size from the custom property
                maxThreadPoolSize = messageProcessor.getCustomProperties().get_max_reconstitute_threadpool_size();

                int noOfCores = CpuInfo.getAvailableProcessors();

                if (maxThreadPoolSize <= 0)
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.info(tc, "INVALID_RECONSTITUTE_THREADPOOL_SIZE_CWSIP0068", new Object[] { maxThreadPoolSize });
                    maxThreadPoolSize = noOfCores;
                }

                if (maxThreadPoolSize > noOfCores)
                    SibTr.warning(tc, "INVALID_RECONSTITUTE_THREADPOOL_SIZE_CWSIP0069");

            }
            else {
                // File store: Don't use multiple threads as it may lead to contention
                maxThreadPoolSize = 1;
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.info(tc, "MAX_RECONSTITUTE_THREADPOOL_SIZE_CWSIP0070", new Object[] { maxThreadPoolSize });

            _reconstituteThreadpool = new ThreadPoolExecutor(maxThreadPoolSize, maxThreadPoolSize, Long.MAX_VALUE, TimeUnit.MILLISECONDS,
                            new LinkedBlockingQueue<Runnable>());
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createReconstituteThreadPool");
    }
334558
public static void setThreadPool(ThreadPoolExecutor pool) {
		if (ConcurrencyTools.pool != pool) {
			shutdown();
			ConcurrencyTools.pool = pool;
		}
	}
1027915
private void balance() {
        // only try to balance when we're not terminating
        if(!isTerminated()) {
            Set<Map.Entry<Thread, Tracking>> threads = liveThreads.entrySet();
            long liveAvgTimeTotal = 0;
            long liveAvgCpuTotal = 0;
            long liveCount = 0;
            for (Map.Entry<Thread, Tracking> e : threads) {
                if (!e.getKey().isAlive()) {
                    // thread is dead or otherwise hosed
                    threads.remove(e);
                } else {
                    liveAvgTimeTotal += e.getValue().avgTotalTime;
                    liveAvgCpuTotal += e.getValue().avgCpuTime;
                    liveCount++;
                }
            }
            long waitTime = 1;
            long cpuTime = 1;
            if(liveCount > 0) {
                waitTime = liveAvgTimeTotal / liveCount;
                cpuTime = liveAvgCpuTotal / liveCount;
            }

            int size = 1;
            if(cpuTime > 0) {
                size = (int) ceil((CPUS * targetUtilization * (1 + (waitTime / cpuTime))));
            }
            size = Math.min(size, threadPoolExecutor.getMaximumPoolSize());

            // TODO remove debugging
            //System.out.println(waitTime / 1000000 + " ms");
            //System.out.println(cpuTime / 1000000 + " ms");
            //System.out.println(size);

            threadPoolExecutor.setCorePoolSize(size);
        }
    }
1364859
public void setMin(final T pmin) {
    if (pmin == null) {
      getInputElement().removeAttribute("min");
    } else {
      getInputElement().setMin(this.numberRenderer.render(pmin));
    }
  }
333214
@Override
    public void postToMainThread(Runnable runnable) {
        if (mMainHandler == null) {
            synchronized (mLock) {
                if (mMainHandler == null) {
                    mMainHandler = new Handler(Looper.getMainLooper());
                }
            }
        }
        //noinspection ConstantConditions
        mMainHandler.post(runnable);
    }
1077528
public void setShortRunningThreadPool(BlockingExecutor executor)
   {
      if (trace)
         log.trace("short running executor:" + (executor != null ? executor.getClass() : "null"));

      if (executor != null)
      {
         if (executor instanceof StatisticsExecutor)
         {
            this.shortRunningExecutor = (StatisticsExecutor) executor;
         }
         else
         {
            this.shortRunningExecutor = new StatisticsExecutorImpl(executor);
         }
      }
   }
645450
public static void setDaemonizedThreadFactories(MediaDriver.Context mediaDriverCtx){

        //Set thread factories so we can make the Aeron threads daemon threads (some are not by default)
        mediaDriverCtx.conductorThreadFactory(r -> {
            Thread t = new Thread(r);
            t.setDaemon(true);
            t.setName("aeron-conductor-thread-" + conductorCount.getAndIncrement());
            return t;
        });

        mediaDriverCtx.receiverThreadFactory(r -> {
            Thread t = new Thread(r);
            t.setDaemon(true);
            t.setName("aeron-receiver-thread-" + receiverCount.getAndIncrement());
            return t;
        });


        mediaDriverCtx.senderThreadFactory(r -> {
            Thread t = new Thread(r);
            t.setDaemon(true);
            t.setName("aeron-sender-thread-" + senderCount.getAndIncrement());
            return t;
        });


        mediaDriverCtx.sharedNetworkThreadFactory(r -> {
            Thread t = new Thread(r);
            t.setDaemon(true);
            t.setName("aeron-shared-network-thread-" + sharedNetworkCount.getAndIncrement());
            return t;
        });

        mediaDriverCtx.sharedThreadFactory(r -> {
            Thread t = new Thread(r);
            t.setDaemon(true);
            t.setName("aeron-shared-thread-" + sharedThreadCount.getAndIncrement());
            return t;
        });
    }
814225
public static int getTotalThreadCount() {
		ThreadGroup parentThread = Thread.currentThread().getThreadGroup();
		while(null != parentThread.getParent()) {
			parentThread = parentThread.getParent();
		}
		return parentThread.activeCount();
	}