/** * Constructs a new task engine. */ private TaskEngine() { timer = new Timer("TaskEngine-timer", true); final ThreadFactory threadFactory = new NamedThreadFactory( "TaskEngine-pool-", true, Thread.NORM_PRIORITY, Thread.currentThread().getThreadGroup(), 0L ); executor = Executors.newCachedThreadPool( threadFactory ); }
/** * Starts the services used by the HttpSessionManager. * * (Re)creates and configures a pooled executor to handle async routing for incoming packets with a configurable * (through property "xmpp.httpbind.worker.threads") amount of threads; also uses an unbounded task queue and * configurable ("xmpp.httpbind.worker.timeout") keep-alive. * * Note: Apart from the processing threads configured in this class, the server also uses a threadpool to perform * the network IO (as configured in ({@link HttpBindManager}). BOSH installations expecting heavy loads may want to * allocate additional threads to this worker pool to ensure timely delivery of inbound packets */ public void start() { Log.info( "Starting instance" ); this.sessionManager = SessionManager.getInstance(); final int maxClientPoolSize = JiveGlobals.getIntProperty( "xmpp.client.processing.threads", 8 ); final int maxPoolSize = JiveGlobals.getIntProperty("xmpp.httpbind.worker.threads", maxClientPoolSize ); final int keepAlive = JiveGlobals.getIntProperty( "xmpp.httpbind.worker.timeout", 60 ); sendPacketPool = new ThreadPoolExecutor(getCorePoolSize(maxPoolSize), maxPoolSize, keepAlive, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), // unbounded task queue new NamedThreadFactory( "httpbind-worker-", true, null, Thread.currentThread().getThreadGroup(), null ) ); sendPacketPool.prestartCoreThread(); // Periodically check for Sessions that need a cleanup. inactivityTask = new HttpSessionReaper(); TaskEngine.getInstance().schedule( inactivityTask, 30 * JiveConstants.SECOND, 30 * JiveConstants.SECOND ); }
final ExecutorFilter executorFilter = new ExecutorFilter( initialSize, configuration.getMaxThreadPoolSize(), 60, TimeUnit.SECONDS ); final ThreadPoolExecutor eventExecutor = (ThreadPoolExecutor) executorFilter.getExecutor(); final ThreadFactory threadFactory = new NamedThreadFactory( name + "-thread-", eventExecutor.getThreadFactory(), true, null ); eventExecutor.setThreadFactory( threadFactory );
/** * Constructs a new task engine. */ private TaskEngine() { timer = new Timer("TaskEngine-timer", true); final ThreadFactory threadFactory = new NamedThreadFactory( "TaskEngine-pool-", true, Thread.NORM_PRIORITY, Thread.currentThread().getThreadGroup(), 0L ); executor = Executors.newCachedThreadPool( threadFactory ); }
/** * Starts the services used by the HttpSessionManager. * * (Re)creates and configures a pooled executor to handle async routing for incoming packets with a configurable * (through property "xmpp.httpbind.worker.threads") amount of threads; also uses an unbounded task queue and * configurable ("xmpp.httpbind.worker.timeout") keep-alive. * * Note: Apart from the processing threads configured in this class, the server also uses a threadpool to perform * the network IO (as configured in ({@link HttpBindManager}). BOSH installations expecting heavy loads may want to * allocate additional threads to this worker pool to ensure timely delivery of inbound packets */ public void start() { Log.info( "Starting instance" ); this.sessionManager = SessionManager.getInstance(); final int maxClientPoolSize = JiveGlobals.getIntProperty( "xmpp.client.processing.threads", 8 ); final int maxPoolSize = JiveGlobals.getIntProperty("xmpp.httpbind.worker.threads", maxClientPoolSize ); final int keepAlive = JiveGlobals.getIntProperty( "xmpp.httpbind.worker.timeout", 60 ); sendPacketPool = new ThreadPoolExecutor(getCorePoolSize(maxPoolSize), maxPoolSize, keepAlive, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), // unbounded task queue new NamedThreadFactory( "httpbind-worker-", true, null, Thread.currentThread().getThreadGroup(), null ) ); sendPacketPool.prestartCoreThread(); // Periodically check for Sessions that need a cleanup. inactivityTask = new HttpSessionReaper(); TaskEngine.getInstance().schedule( inactivityTask, 30 * JiveConstants.SECOND, 30 * JiveConstants.SECOND ); }
final ExecutorFilter executorFilter = new ExecutorFilter( initialSize, configuration.getMaxThreadPoolSize(), 60, TimeUnit.SECONDS ); final ThreadPoolExecutor eventExecutor = (ThreadPoolExecutor) executorFilter.getExecutor(); final ThreadFactory threadFactory = new NamedThreadFactory( name + "-thread-", eventExecutor.getThreadFactory(), true, null ); eventExecutor.setThreadFactory( threadFactory );