/** Create a ThreadPool instance. * * @param jmx UNUSED * @return ThreadPool instance. If JMX support is requested, you need to * call register() in order to set a name. */ public static ThreadPool createThreadPool(boolean jmx) { return new ThreadPool(); }
public boolean getDaemon() { return tp.getDaemon(); }
public int getMaxSpareThreads() { return tp.getMaxSpareThreads(); }
/** * Start a new thread, with no method in it */ ControlRunnable(ThreadPool p) { toRun = null; shouldTerminate = false; shouldRun = false; this.p = p; t = new ThreadWithAttributes(p, this); t.setDaemon(true); t.setName(p.getName() + "-Processor" + p.incSequence()); t.setPriority(p.getThreadPriority()); p.addThread( t, this ); noThData=true; t.start(); }
public synchronized void start() { stopThePool=false; currentThreadCount = 0; currentThreadsBusy = 0; adjustLimits(); pool = new ControlRunnable[maxThreads]; openThreads(minSpareThreads); if (maxSpareThreads < maxThreads) { monitor = new MonitorRunnable(this); } }
public int getMaxThreads() { return tp.getMaxThreads(); }
public int getMinSpareThreads() { return tp.getMinSpareThreads(); }
/** * Start the background processing thread. */ private void threadStart() { thread = new Thread(this, tp.getName()); thread.setPriority(getThreadPriority()); thread.setDaemon(true); thread.start(); }
public void run(Runnable r) { ControlRunnable c = findControlRunnable(); c.runIt(r); }
public void run() { while(true) { try { // Sleep for a while. synchronized(this) { this.wait(interval); } // Check if should terminate. // termination happens when the pool is shutting down. if(shouldTerminate) { break; } // Harvest idle threads. p.checkSpareControllers(); } catch(Throwable t) { ThreadPool.log.error("Unexpected exception", t); } } }
public int getMaxThreads() { return tp.getMaxThreads(); }
public int getMinSpareThreads() { return tp.getMinSpareThreads(); }
/** * Create and return a new processor suitable for processing HTTP * requests and returning the corresponding responses. */ private MasterSlaveWorkerThread newWorkerThread() { MasterSlaveWorkerThread workerThread = new MasterSlaveWorkerThread(this, tp.getName() + "-" + (++curThreads)); workerThread.start(); created.addElement(workerThread); return (workerThread); }
/** * Executes a given Runnable on a thread in the pool, block if needed. */ public void runIt(ThreadPoolRunnable r) { if(null == r) { throw new NullPointerException(); } ControlRunnable c = findControlRunnable(); c.runIt(r); }
public int getMaxSpareThreads() { return tp.getMaxSpareThreads(); }
public int getMaxThreads() { return tp.getMaxThreads(); }
public int getMinSpareThreads() { return tp.getMinSpareThreads(); }
public PoolTcpEndpoint() { tp = new ThreadPool(); }
public boolean getDaemon() { return tp.getDaemon(); }