Commit 5a38e194 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-992: On restart of HTTP Session Manager, all components should be re-initialized.

parent 2ade78e7
...@@ -81,25 +81,37 @@ public class HttpSessionManager { ...@@ -81,25 +81,37 @@ public class HttpSessionManager {
JiveGlobals.migrateProperty("xmpp.httpbind.worker.threads"); JiveGlobals.migrateProperty("xmpp.httpbind.worker.threads");
JiveGlobals.migrateProperty("xmpp.httpbind.worker.timeout"); JiveGlobals.migrateProperty("xmpp.httpbind.worker.timeout");
}
this.sessionManager = SessionManager.getInstance(); /**
init(); * @deprecated As of Openfire 4.0.0, the functionality of this method was added to the implementation of #start().
*/
@Deprecated
public void init() {}
private int getCorePoolSize(int maxPoolSize) {
return (maxPoolSize/4)+1;
} }
public void init() { /**
Log.warn("HttpSessionManager.init() recreate sendPacketPool"); * Starts the services used by the HttpSessionManager.
// Configure a pooled executor to handle async routing for incoming packets *
// with a default size of 16 threads ("xmpp.httpbind.worker.threads"); also * (Re)creates and configures a pooled executor to handle async routing for incoming packets with a configurable
// uses an unbounded task queue and configurable keep-alive (default: 60 secs) * (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" );
// Note: server supports up to 254 client threads by default (@see HttpBindManager) this.sessionManager = SessionManager.getInstance();
// BOSH installations expecting heavy loads may want to allocate additional threads
// to this worker pool to ensure timely delivery of inbound packets
int maxPoolSize = JiveGlobals.getIntProperty("xmpp.httpbind.worker.threads", final int maxClientPoolSize = JiveGlobals.getIntProperty( "xmpp.client.processing.threads", 8 );
// use deprecated property as default (shared with ConnectionManagerImpl) final int maxPoolSize = JiveGlobals.getIntProperty("xmpp.httpbind.worker.threads", maxClientPoolSize );
JiveGlobals.getIntProperty("xmpp.client.processing.threads", 8)); final int keepAlive = JiveGlobals.getIntProperty( "xmpp.httpbind.worker.timeout", 60 );
int keepAlive = JiveGlobals.getIntProperty("xmpp.httpbind.worker.timeout", 60);
sendPacketPool = new ThreadPoolExecutor(getCorePoolSize(maxPoolSize), maxPoolSize, keepAlive, TimeUnit.SECONDS, sendPacketPool = new ThreadPoolExecutor(getCorePoolSize(maxPoolSize), maxPoolSize, keepAlive, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(), // unbounded task queue new LinkedBlockingQueue<Runnable>(), // unbounded task queue
...@@ -113,26 +125,19 @@ public class HttpSessionManager { ...@@ -113,26 +125,19 @@ public class HttpSessionManager {
return thread; return thread;
} }
}); });
}
private int getCorePoolSize(int maxPoolSize) { sendPacketPool.prestartCoreThread();
return (maxPoolSize/4)+1;
}
/** // Periodically check for Sessions that need a cleanup.
* Starts the services used by the HttpSessionManager.
*/
public void start() {
inactivityTask = new HttpSessionReaper(); inactivityTask = new HttpSessionReaper();
TaskEngine.getInstance().schedule(inactivityTask, 30 * JiveConstants.SECOND, TaskEngine.getInstance().schedule( inactivityTask, 30 * JiveConstants.SECOND, 30 * JiveConstants.SECOND );
30 * JiveConstants.SECOND);
sendPacketPool.prestartCoreThread();
} }
/** /**
* Stops any services and cleans up any resources used by the HttpSessionManager. * Stops any services and cleans up any resources used by the HttpSessionManager.
*/ */
public void stop() { public void stop() {
Log.info( "Stopping instance" );
inactivityTask.cancel(); inactivityTask.cancel();
for (HttpSession session : sessionMap.values()) { for (HttpSession session : sessionMap.values()) {
session.close(); session.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment