View | Details | Raw Unified | Return to bug 52955
Collapse All | Expand All

(-)java/org/apache/catalina/core/ContainerBase.java (-2 / +26 lines)
Lines 31-38 Link Here
31
import java.util.concurrent.Callable;
31
import java.util.concurrent.Callable;
32
import java.util.concurrent.Future;
32
import java.util.concurrent.Future;
33
import java.util.concurrent.LinkedBlockingQueue;
33
import java.util.concurrent.LinkedBlockingQueue;
34
import java.util.concurrent.ThreadFactory;
34
import java.util.concurrent.ThreadPoolExecutor;
35
import java.util.concurrent.ThreadPoolExecutor;
35
import java.util.concurrent.TimeUnit;
36
import java.util.concurrent.TimeUnit;
37
import java.util.concurrent.atomic.AtomicLong;
36
import java.util.concurrent.locks.Lock;
38
import java.util.concurrent.locks.Lock;
37
import java.util.concurrent.locks.ReadWriteLock;
39
import java.util.concurrent.locks.ReadWriteLock;
38
import java.util.concurrent.locks.ReentrantReadWriteLock;
40
import java.util.concurrent.locks.ReentrantReadWriteLock;
Lines 130-136 Link Here
130
public abstract class ContainerBase extends LifecycleMBeanBase
132
public abstract class ContainerBase extends LifecycleMBeanBase
131
        implements Container {
133
        implements Container {
132
    private static final org.apache.juli.logging.Log log=
134
	/**
135
    * Customisation of the deployer threads
136
    */
137
    public class StartStopThreadFactory implements ThreadFactory {
138
139
        private ThreadGroup group = new ThreadGroup("tomcat-deployers");
140
        private final AtomicLong counter = new AtomicLong(0);
141
142
        @Override
143
        public Thread newThread(Runnable runnable) {
144
            Thread t = new Thread(group, runnable);
145
            t.setName(String.format("tomcat-deployer-" + counter.getAndIncrement()));
146
            return t;
147
        }
148
	}
149
150
151
	private static final org.apache.juli.logging.Log log=
133
        org.apache.juli.logging.LogFactory.getLog( ContainerBase.class );
152
        org.apache.juli.logging.LogFactory.getLog( ContainerBase.class );
134
    /**
153
    /**
Lines 295-300 Link Here
295
    private int startStopThreads = 1;
314
    private int startStopThreads = 1;
296
    protected ThreadPoolExecutor startStopExecutor;
315
    protected ThreadPoolExecutor startStopExecutor;
316
317
	private ThreadFactory threadFactory;
318
297
    // ------------------------------------------------------------- Properties
319
    // ------------------------------------------------------------- Properties
298
    @Override
320
    @Override
Lines 1079-1090 Link Here
1079
    @Override
1101
    @Override
1080
    protected void initInternal() throws LifecycleException {
1102
    protected void initInternal() throws LifecycleException {
1103
        threadFactory = new StartStopThreadFactory();
1081
        BlockingQueue<Runnable> startStopQueue =
1104
        BlockingQueue<Runnable> startStopQueue =
1082
            new LinkedBlockingQueue<Runnable>();
1105
            new LinkedBlockingQueue<Runnable>();
1083
        startStopExecutor = new ThreadPoolExecutor(
1106
        startStopExecutor = new ThreadPoolExecutor(
1084
                getStartStopThreadsInternal(),
1107
                getStartStopThreadsInternal(),
1085
                getStartStopThreadsInternal(), 10, TimeUnit.SECONDS,
1108
                getStartStopThreadsInternal(), 10, TimeUnit.SECONDS,
1086
                startStopQueue);
1109
                startStopQueue,
1110
                threadFactory);
1087
        startStopExecutor.allowCoreThreadTimeOut(true);
1111
        startStopExecutor.allowCoreThreadTimeOut(true);
1088
        super.initInternal();
1112
        super.initInternal();
1089
    }
1113
    }

Return to bug 52955