From 6eb8953c4b51e520b807dc9675253cf566073945 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 1 May 2009 20:36:11 +0000 Subject: [PATCH] Allow flush time to be customized. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5765 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/PresentsSession.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/presents/server/PresentsSession.java b/src/java/com/threerings/presents/server/PresentsSession.java index b409a8fbe..f9b1ba17a 100644 --- a/src/java/com/threerings/presents/server/PresentsSession.java +++ b/src/java/com/threerings/presents/server/PresentsSession.java @@ -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, 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");