Allow flush time to be customized.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5765 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-05-01 20:36:11 +00:00
parent bafb7f78c0
commit 6eb8953c4b
@@ -126,7 +126,7 @@ public class PresentsSession
*/
public boolean checkExpired (long now)
{
return (getConnection() == null && (now - _networkStamp > FLUSH_TIME));
return (getConnection() == null && (now - _networkStamp > getFlushTime()));
}
/**
@@ -902,6 +902,15 @@ public class PresentsSession
(_username.getClass().getSimpleName() + "(" + _username + ")");
}
/**
* Returns the duration (in milliseconds) after which a disconnected session will be terminated
* and flushed.
*/
protected long getFlushTime ()
{
return DEFAULT_FLUSH_TIME;
}
/**
* Derived classes override this to augment stringification.
*/
@@ -1137,9 +1146,8 @@ public class PresentsSession
/** A mapping of message dispatchers. */
protected static Map<Class<?>, MessageDispatcher> _disps = Maps.newHashMap();
/** The amount of time after disconnection a user is allowed before their session is forcibly
* ended. */
protected static final long FLUSH_TIME = 7 * 60 * 1000L;
/** Default period a user is allowed after disconn before their session is forcibly ended. */
protected static final long DEFAULT_FLUSH_TIME = 7 * 60 * 1000L;
// TEMP
protected static final boolean PING_DEBUG = Boolean.getBoolean("ping_debug");