Commit 0a0066a4 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Added means to over-ride client specified wait time.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6057 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6baf9928
...@@ -285,7 +285,7 @@ public class HttpSession extends ClientSession { ...@@ -285,7 +285,7 @@ public class HttpSession extends ClientSession {
} }
/** /**
* This attribute specifies the longest time (in seconds) that the connection manager is allowed * Specifies the longest time (in seconds) that the connection manager is allowed
* to wait before responding to any request during the session. This enables the client to * to wait before responding to any request during the session. This enables the client to
* prevent its TCP connection from expiring due to inactivity, as well as to limit the delay * prevent its TCP connection from expiring due to inactivity, as well as to limit the delay
* before it discovers any network failure. * before it discovers any network failure.
...@@ -297,7 +297,7 @@ public class HttpSession extends ClientSession { ...@@ -297,7 +297,7 @@ public class HttpSession extends ClientSession {
} }
/** /**
* This attribute specifies the longest time (in seconds) that the connection manager is allowed * Specifies the longest time (in seconds) that the connection manager is allowed
* to wait before responding to any request during the session. This enables the client to * to wait before responding to any request during the session. This enables the client to
* prevent its TCP connection from expiring due to inactivity, as well as to limit the delay * prevent its TCP connection from expiring due to inactivity, as well as to limit the delay
* before it discovers any network failure. * before it discovers any network failure.
...@@ -309,7 +309,7 @@ public class HttpSession extends ClientSession { ...@@ -309,7 +309,7 @@ public class HttpSession extends ClientSession {
} }
/** /**
* This attribute specifies the maximum number of requests the connection manager is allowed * Specifies the maximum number of requests the connection manager is allowed
* to keep waiting at any one time during the session. (For example, if a constrained client * to keep waiting at any one time during the session. (For example, if a constrained client
* is unable to keep open more than two HTTP connections to the same HTTP server simultaneously, * is unable to keep open more than two HTTP connections to the same HTTP server simultaneously,
* then it SHOULD specify a value of "1".) * then it SHOULD specify a value of "1".)
...@@ -322,7 +322,7 @@ public class HttpSession extends ClientSession { ...@@ -322,7 +322,7 @@ public class HttpSession extends ClientSession {
} }
/** /**
* This attribute specifies the maximum number of requests the connection manager is allowed * Specifies the maximum number of requests the connection manager is allowed
* to keep waiting at any one time during the session. (For example, if a constrained client * to keep waiting at any one time during the session. (For example, if a constrained client
* is unable to keep open more than two HTTP connections to the same HTTP server simultaneously, * is unable to keep open more than two HTTP connections to the same HTTP server simultaneously,
* then it SHOULD specify a value of "1".) * then it SHOULD specify a value of "1".)
......
...@@ -60,6 +60,14 @@ public class HttpSessionManager { ...@@ -60,6 +60,14 @@ public class HttpSessionManager {
*/ */
private static int pollingInterval; private static int pollingInterval;
/**
* Specifies the longest time (in seconds) that the connection manager is allowed to wait before
* responding to any request during the session. This enables the client to prevent its TCP
* connection from expiring due to inactivity, as well as to limit the delay before it
* discovers any network failure.
*/
private static int maxWait;
private SessionManager sessionManager; private SessionManager sessionManager;
private Map<String, HttpSession> sessionMap = new ConcurrentHashMap<String, HttpSession>(); private Map<String, HttpSession> sessionMap = new ConcurrentHashMap<String, HttpSession>();
private Timer inactivityTimer; private Timer inactivityTimer;
...@@ -70,6 +78,8 @@ public class HttpSessionManager { ...@@ -70,6 +78,8 @@ public class HttpSessionManager {
inactivityTimeout = JiveGlobals.getIntProperty("xmpp.httpbind.client.idle", 30); inactivityTimeout = JiveGlobals.getIntProperty("xmpp.httpbind.client.idle", 30);
maxRequests = JiveGlobals.getIntProperty("xmpp.httpbind.client.requests.max", 2); maxRequests = JiveGlobals.getIntProperty("xmpp.httpbind.client.requests.max", 2);
pollingInterval = JiveGlobals.getIntProperty("xmpp.httpbind.client.requests.polling", 5); pollingInterval = JiveGlobals.getIntProperty("xmpp.httpbind.client.requests.polling", 5);
maxWait = JiveGlobals.getIntProperty("xmpp.httpbind.client.requests.wait",
Integer.MAX_VALUE);
} }
public HttpSessionManager() { public HttpSessionManager() {
...@@ -133,7 +143,7 @@ public class HttpSessionManager { ...@@ -133,7 +143,7 @@ public class HttpSessionManager {
int hold = getIntAttribute(rootNode.attributeValue("hold"), 1); int hold = getIntAttribute(rootNode.attributeValue("hold"), 1);
HttpSession session = createSession(connection.getRequestId(), address); HttpSession session = createSession(connection.getRequestId(), address);
session.setWait(wait); session.setWait(Math.min(wait, maxWait));
session.setHold(hold); session.setHold(hold);
session.setSecure(connection.isSecure()); session.setSecure(connection.isSecure());
session.setMaxPollingInterval(pollingInterval); session.setMaxPollingInterval(pollingInterval);
......
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