Methods Summary |
---|
public void | addLifecycleListener(org.apache.catalina.LifecycleListener listener)Add a LifecycleEvent listener to this component.
lifecycle.addLifecycleListener(listener);
|
public void | execute(java.lang.Runnable command)
if ( executor != null ) {
try {
executor.execute(command);
} catch (RejectedExecutionException rx) {
//there could have been contention around the queue
if ( !( (TaskQueue) executor.getQueue()).force(command) ) throw new RejectedExecutionException();
}
} else throw new IllegalStateException("StandardThreadPool not started.");
|
public org.apache.catalina.LifecycleListener[] | findLifecycleListeners()Get the lifecycle listeners associated with this lifecycle. If this
Lifecycle has no listeners registered, a zero-length array is returned.
return lifecycle.findLifecycleListeners();
|
public int | getActiveCount()
return (executor != null) ? executor.getActiveCount() : 0;
|
public long | getCompletedTaskCount()
return (executor != null) ? executor.getCompletedTaskCount() : 0;
|
public int | getCorePoolSize()
return (executor != null) ? executor.getCorePoolSize() : 0;
|
public int | getLargestPoolSize()
return (executor != null) ? executor.getLargestPoolSize() : 0;
|
public int | getMaxIdleTime()
return maxIdleTime;
|
public int | getMaxThreads()
return maxThreads;
|
public int | getMinSpareThreads()
return minSpareThreads;
|
public java.lang.String | getName()
return name;
|
public java.lang.String | getNamePrefix()
return namePrefix;
|
public int | getPoolSize()
return (executor != null) ? executor.getPoolSize() : 0;
|
public int | getThreadPriority()
return threadPriority;
|
public boolean | isDaemon()
return daemon;
|
public void | removeLifecycleListener(org.apache.catalina.LifecycleListener listener)Remove a LifecycleEvent listener from this component.
lifecycle.removeLifecycleListener(listener);
|
public void | setDaemon(boolean daemon)
this.daemon = daemon;
|
public void | setMaxIdleTime(int maxIdleTime)
this.maxIdleTime = maxIdleTime;
|
public void | setMaxThreads(int maxThreads)
this.maxThreads = maxThreads;
|
public void | setMinSpareThreads(int minSpareThreads)
this.minSpareThreads = minSpareThreads;
|
public void | setName(java.lang.String name)
this.name = name;
|
public void | setNamePrefix(java.lang.String namePrefix)
this.namePrefix = namePrefix;
|
public void | setThreadPriority(int threadPriority)
this.threadPriority = threadPriority;
|
public void | start()
lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
TaskQueue taskqueue = new TaskQueue();
TaskThreadFactory tf = new TaskThreadFactory(namePrefix);
lifecycle.fireLifecycleEvent(START_EVENT, null);
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf);
taskqueue.setParent( (ThreadPoolExecutor) executor);
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
|
public void | stop()
lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
if ( executor != null ) executor.shutdown();
executor = null;
lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
|