public ServicePool(ServerService next,
String name,
Properties properties) {
this.next = next;
final int threads = getInt(properties, "threads", 100);
final int keepAliveTime = (1000 * 60 * 5);
ThreadPoolExecutor p = new ThreadPoolExecutor(threads, threads, keepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
p.setThreadFactory(new ThreadFactory() {
private volatile int id = 0;
public Thread newThread(Runnable arg0) {
Thread thread = new Thread(arg0, name + " " + getNextID());
return thread;
}
private int getNextID() {
return id++;
}
});
executor = p;
}
|