Search in sources :

Example 1 with TaskThreadFactory

use of org.apache.tomcat.util.threads.TaskThreadFactory in project tomcat by apache.

the class AbstractEndpoint method createExecutor.

public void createExecutor() {
    internalExecutor = true;
    TaskQueue taskqueue = new TaskQueue();
    TaskThreadFactory tf = new TaskThreadFactory(getName() + "-exec-", daemon, getThreadPriority());
    executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), 60, TimeUnit.SECONDS, taskqueue, tf);
    taskqueue.setParent((ThreadPoolExecutor) executor);
}
Also used : TaskQueue(org.apache.tomcat.util.threads.TaskQueue) ThreadPoolExecutor(org.apache.tomcat.util.threads.ThreadPoolExecutor) TaskThreadFactory(org.apache.tomcat.util.threads.TaskThreadFactory)

Example 2 with TaskThreadFactory

use of org.apache.tomcat.util.threads.TaskThreadFactory in project tomcat by apache.

the class StandardThreadExecutor method startInternal.

/**
     * Start the component and implement the requirements
     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
     *
     * @exception LifecycleException if this component detects a fatal error
     *  that prevents this component from being used
     */
@Override
protected void startInternal() throws LifecycleException {
    taskqueue = new TaskQueue(maxQueueSize);
    TaskThreadFactory tf = new TaskThreadFactory(namePrefix, daemon, getThreadPriority());
    executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS, taskqueue, tf);
    executor.setThreadRenewalDelay(threadRenewalDelay);
    if (prestartminSpareThreads) {
        executor.prestartAllCoreThreads();
    }
    taskqueue.setParent(executor);
    setState(LifecycleState.STARTING);
}
Also used : TaskQueue(org.apache.tomcat.util.threads.TaskQueue) ThreadPoolExecutor(org.apache.tomcat.util.threads.ThreadPoolExecutor) TaskThreadFactory(org.apache.tomcat.util.threads.TaskThreadFactory)

Aggregations

TaskQueue (org.apache.tomcat.util.threads.TaskQueue)2 TaskThreadFactory (org.apache.tomcat.util.threads.TaskThreadFactory)2 ThreadPoolExecutor (org.apache.tomcat.util.threads.ThreadPoolExecutor)2