/** * Set the minimum number of threads. * * @param minThreads minimum number of threads * @see #getMinThreads */ @Override public void setMinThreads(int minThreads) { _minThreads = minThreads; if (_minThreads > _maxThreads) _maxThreads = _minThreads; int threads = _threadsStarted.get(); if (isStarted() && threads < _minThreads) startThreads(_minThreads - threads); }
@Override protected void doStart() throws Exception { _tryExecutor = new ReservedThreadExecutor(this,_reservedThreads); addBean(_tryExecutor); super.doStart(); _threadsStarted.set(0); startThreads(_minThreads); }
@Override public void execute(Runnable job) { if (LOG.isDebugEnabled()) LOG.debug("queue {}",job); if (!isRunning() || !_jobs.offer(job)) { LOG.warn("{} rejected {}", this, job); throw new RejectedExecutionException(job.toString()); } else { // Make sure there is at least one thread executing the job. if (getThreads() == 0) startThreads(1); } }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); startThreads(_minThreads); }
/** * Set the minimum number of threads. * Delegated to the named or anonymous Pool. * * @param minThreads minimum number of threads * @see #getMinThreads */ @Override public void setMinThreads(int minThreads) { _minThreads = minThreads; if (_minThreads > _maxThreads) _maxThreads = _minThreads; int threads = _threadsStarted.get(); if (isStarted() && threads < _minThreads) startThreads(_minThreads - threads); }
/** * Set the minimum number of threads. * Delegated to the named or anonymous Pool. * * @param minThreads minimum number of threads * @see #getMinThreads */ @Override public void setMinThreads(int minThreads) { _minThreads = minThreads; if (_minThreads > _maxThreads) _maxThreads = _minThreads; int threads = _threadsStarted.get(); if (isStarted() && threads < _minThreads) startThreads(_minThreads - threads); }
/** * Set the minimum number of threads. * * @param minThreads minimum number of threads * @see #getMinThreads */ @Override public void setMinThreads(int minThreads) { _minThreads = minThreads; if (_minThreads > _maxThreads) _maxThreads = _minThreads; int threads = _threadsStarted.get(); if (isStarted() && threads < _minThreads) startThreads(_minThreads - threads); }
/** * Set the minimum number of threads. * Delegated to the named or anonymous Pool. * * @param minThreads minimum number of threads * @see #getMinThreads */ @Override public void setMinThreads(int minThreads) { _minThreads = minThreads; if (_minThreads > _maxThreads) _maxThreads = _minThreads; int threads = _threadsStarted.get(); if (isStarted() && threads < _minThreads) startThreads(_minThreads - threads); }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); if (_jobs == null) setQueue(new BlockingArrayQueue<Runnable>(_minThreads, _minThreads)); startThreads(_minThreads); }
@Override public void execute(Runnable job) { if (!isRunning() || !_jobs.offer(job)) { LOG.warn("{} rejected {}", this, job); throw new RejectedExecutionException(job.toString()); } else { // Make sure there is at least one thread executing the job. if (getThreads() == 0) startThreads(1); } }
@Override protected void doStart() throws Exception { super.doStart(); _threadsStarted.set(0); if (_jobs == null) setQueue(new BlockingArrayQueue<Runnable>(_minThreads, _minThreads)); startThreads(_minThreads); }
@Override protected void doStart() throws Exception { _tryExecutor = new ReservedThreadExecutor(this,_reservedThreads); addBean(_tryExecutor); super.doStart(); _threadsStarted.set(0); startThreads(_minThreads); }
@Override public void execute(Runnable job) { if (LOG.isDebugEnabled()) LOG.debug("queue {}",job); if (!isRunning() || !_jobs.offer(job)) { LOG.warn("{} rejected {}", this, job); throw new RejectedExecutionException(job.toString()); } else { // Make sure there is at least one thread executing the job. if (getThreads() == 0) startThreads(1); } }