/** Set the minimum number of threads. * Delegated to the named or anonymous Pool. * @see #getMinThreads * @param minThreads minimum number of threads */ public void setMinThreads(int minThreads) { _minThreads=minThreads; if (_minThreads>_maxThreads) _maxThreads=_minThreads; int threads=_threadsStarted.get(); while (isStarted() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
/** Set the minimum number of threads. * Delegated to the named or anonymous Pool. * @see #getMinThreads * @param minThreads minimum number of threads */ public void setMinThreads(int minThreads) { _minThreads=minThreads; if (_minThreads>_maxThreads) _maxThreads=_minThreads; int threads=_threadsStarted.get(); while (isStarted() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
/** Set the minimum number of threads. * Delegated to the named or anonymous Pool. * @see #getMinThreads * @param minThreads minimum number of threads */ public void setMinThreads(int minThreads) { _minThreads=minThreads; if (_minThreads>_maxThreads) _maxThreads=_minThreads; int threads=_threadsStarted.get(); while (isStarted() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
/** Set the minimum number of threads. * Delegated to the named or anonymous Pool. * @see #getMinThreads * @param minThreads minimum number of threads */ public void setMinThreads(int minThreads) { _minThreads=minThreads; if (_minThreads>_maxThreads) _maxThreads=_minThreads; int threads=_threadsStarted.get(); while (isStarted() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); if (_jobs==null) { _jobs=_maxQueued>0 ?new ArrayBlockingQueue<Runnable>(_maxQueued) :new BlockingArrayQueue<Runnable>(_minThreads,_minThreads); } int threads=_threadsStarted.get(); while (isRunning() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); if (_jobs==null) { _jobs=_maxQueued>0 ?new ArrayBlockingQueue<Runnable>(_maxQueued) :new BlockingArrayQueue<Runnable>(_minThreads,_minThreads); } int threads=_threadsStarted.get(); while (isRunning() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); if (_jobs==null) { _jobs=_maxQueued>0 ?new ArrayBlockingQueue<Runnable>(_maxQueued) :new BlockingArrayQueue<Runnable>(_minThreads,_minThreads); } int threads=_threadsStarted.get(); while (isRunning() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); if (_jobs==null) { _jobs=_maxQueued>0 ?new ArrayBlockingQueue<Runnable>(_maxQueued) :new BlockingArrayQueue<Runnable>(_minThreads,_minThreads); } int threads=_threadsStarted.get(); while (isRunning() && threads<_minThreads) { startThread(threads); threads=_threadsStarted.get(); } }
public boolean dispatch(Runnable job) { if (isRunning()) { final int jobQ = _jobs.size(); final int idle = getIdleThreads(); if(_jobs.offer(job)) { // If we had no idle threads or the jobQ is greater than the idle threads if (idle==0 || jobQ>idle) { int threads=_threadsStarted.get(); if (threads<_maxThreads) startThread(threads); } return true; } } LOG.debug("Dispatched {} to stopped {}",job,this); return false; }
public boolean dispatch(Runnable job) { if (isRunning()) { final int jobQ = _jobs.size(); final int idle = getIdleThreads(); if(_jobs.offer(job)) { // If we had no idle threads or the jobQ is greater than the idle threads if (idle==0 || jobQ>idle) { int threads=_threadsStarted.get(); if (threads<_maxThreads) startThread(threads); } return true; } } LOG.debug("Dispatched {} to stopped {}",job,this); return false; }
public boolean dispatch(Runnable job) { if (isRunning()) { final int jobQ = _jobs.size(); final int idle = getIdleThreads(); if(_jobs.offer(job)) { // If we had no idle threads or the jobQ is greater than the idle threads if (idle==0 || jobQ>idle) { int threads=_threadsStarted.get(); if (threads<_maxThreads) startThread(threads); } return true; } } LOG.debug("Dispatched {} to stopped {}",job,this); return false; }
public boolean dispatch(Runnable job) { if (isRunning()) { final int jobQ = _jobs.size(); final int idle = getIdleThreads(); if(_jobs.offer(job)) { // If we had no idle threads or the jobQ is greater than the idle threads if (idle==0 || jobQ>idle) { int threads=_threadsStarted.get(); if (threads<_maxThreads) startThread(threads); } return true; } } LOG.debug("Dispatched {} to stopped {}",job,this); return false; }