From 9520eca6564975aa5fd18d335265c2cd5bcf4333 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 3 Aug 2001 02:21:16 +0000 Subject: [PATCH] Add hooks for derived classes to do things at the start of a client session and when it resumes. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@161 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/PresentsClient.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/presents/server/PresentsClient.java b/src/java/com/threerings/presents/server/PresentsClient.java index 788fb9250..3eb07115b 100644 --- a/src/java/com/threerings/presents/server/PresentsClient.java +++ b/src/java/com/threerings/presents/server/PresentsClient.java @@ -1,5 +1,5 @@ // -// $Id: PresentsClient.java,v 1.11 2001/08/03 02:12:27 mdb Exp $ +// $Id: PresentsClient.java,v 1.12 2001/08/03 02:21:16 mdb Exp $ package com.threerings.cocktail.cher.server; @@ -45,6 +45,7 @@ public class Client implements Subscriber, MessageHandler public void objectAvailable (DObject object) { _clobj = (ClientObject)object; + sessionWillStart(); sendBootstrap(); } @@ -102,6 +103,9 @@ public class Client implements Subscriber, MessageHandler // start using the new connection setConnection(conn); + // let derived classes do any session resuming + sessionWillResume(); + // send off a bootstrap notification immediately because we've // already got our client object sendBootstrap(); @@ -109,6 +113,30 @@ public class Client implements Subscriber, MessageHandler Log.info("Session resumed [client=" + this + "]."); } + /** + * Called when the client session is first started. The client object + * has been created at this point and after this method is executed, + * the bootstrap information will be sent to the client which will + * trigger the start of the session. Derived classes that override + * this function should be sure to call + * super.sessionWillStart(). + */ + protected void sessionWillStart () + { + } + + /** + * Called when the client resumes a session (after having disconnected + * and reconnected). After this method is executed, the bootstrap + * information will be sent to the client which will trigger the + * resumption of the session. Derived classes that override this + * function should be sure to call + * super.sessionWillResume(). + */ + protected void sessionWillResume () + { + } + /** * This is called once we have a handle on the client distributed * object. It sends a bootstrap notification to the client with all