Changed Client to CherClient.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@162 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-03 02:25:49 +00:00
parent 9520eca656
commit 162b179fa7
2 changed files with 23 additions and 23 deletions
@@ -1,5 +1,5 @@
// //
// $Id: ClientManager.java,v 1.7 2001/07/25 17:59:30 mdb Exp $ // $Id: ClientManager.java,v 1.8 2001/08/03 02:25:49 mdb Exp $
package com.threerings.cocktail.cher.server; package com.threerings.cocktail.cher.server;
@@ -32,17 +32,17 @@ public class ClientManager implements ConnectionObserver
/** /**
* Instructs the client manager to construct instances of this derived * Instructs the client manager to construct instances of this derived
* class of <code>Client</code> to managed newly accepted client * class of <code>CherClient</code> to managed newly accepted client
* connections. * connections.
* *
* @see Client * @see CherClient
*/ */
public void setClientClass (Class clientClass) public void setClientClass (Class clientClass)
{ {
// sanity check // sanity check
if (!Client.class.isAssignableFrom(clientClass)) { if (!CherClient.class.isAssignableFrom(clientClass)) {
Log.warning("Requested to use client class that does not " + Log.warning("Requested to use client class that does not " +
"derive from Client " + "derive from CherClient " +
"[class=" + clientClass.getName() + "]."); "[class=" + clientClass.getName() + "].");
return; return;
} }
@@ -75,8 +75,8 @@ public class ClientManager implements ConnectionObserver
/** /**
* Returns the class that should be used when creating a distributed * Returns the class that should be used when creating a distributed
* object to accompany a particular client session. In general, this * object to accompany a particular client session. In general, this
* is only used by the <code>Client</code> object when it is setting * is only used by the <code>CherClient</code> object when it is
* up a client's session for the first time. * setting up a client's session for the first time.
*/ */
public Class getClientObjectClass () public Class getClientObjectClass ()
{ {
@@ -96,7 +96,7 @@ public class ClientManager implements ConnectionObserver
String username = creds.getUsername(); String username = creds.getUsername();
// see if there's a client already registered with this username // see if there's a client already registered with this username
Client client = (Client)_usermap.get(username); CherClient client = (CherClient)_usermap.get(username);
if (client != null) { if (client != null) {
Log.info("Session resumed [username=" + username + Log.info("Session resumed [username=" + username +
@@ -108,7 +108,7 @@ public class ClientManager implements ConnectionObserver
", conn=" + conn + "]."); ", conn=" + conn + "].");
// create a new client and stick'em in the table // create a new client and stick'em in the table
try { try {
client = (Client)_clientClass.newInstance(); client = (CherClient)_clientClass.newInstance();
client.init(this, username, conn); client.init(this, username, conn);
_usermap.put(username, client); _usermap.put(username, client);
} catch (Exception e) { } catch (Exception e) {
@@ -136,7 +136,7 @@ public class ClientManager implements ConnectionObserver
void connectionFailed (Connection conn, IOException fault) void connectionFailed (Connection conn, IOException fault)
{ {
// remove the client from the connection map // remove the client from the connection map
Client client = (Client)_conmap.remove(conn); CherClient client = (CherClient)_conmap.remove(conn);
if (client != null) { if (client != null) {
Log.info("Unmapped failed client [client=" + client + Log.info("Unmapped failed client [client=" + client +
", conn=" + conn + ", fault=" + fault + "]."); ", conn=" + conn + ", fault=" + fault + "].");
@@ -157,7 +157,7 @@ public class ClientManager implements ConnectionObserver
public synchronized void connectionClosed (Connection conn) public synchronized void connectionClosed (Connection conn)
{ {
// remove the client from the connection map // remove the client from the connection map
Client client = (Client)_conmap.remove(conn); CherClient client = (CherClient)_conmap.remove(conn);
if (client != null) { if (client != null) {
Log.info("Unmapped client [client=" + client + Log.info("Unmapped client [client=" + client +
", conn=" + conn + "]."); ", conn=" + conn + "].");
@@ -170,10 +170,10 @@ public class ClientManager implements ConnectionObserver
* Called by the client instance when the client requests a logoff. * Called by the client instance when the client requests a logoff.
* This is called from the conmgr thread. * This is called from the conmgr thread.
*/ */
synchronized void clientDidEndSession (Client client) synchronized void clientDidEndSession (CherClient client)
{ {
// remove the client from the username map // remove the client from the username map
Client rc = (Client)_usermap.remove(client.getUsername()); CherClient rc = (CherClient)_usermap.remove(client.getUsername());
// sanity check because we can // sanity check because we can
if (rc == null) { if (rc == null) {
@@ -192,6 +192,6 @@ public class ClientManager implements ConnectionObserver
protected HashMap _usermap = new HashMap(); protected HashMap _usermap = new HashMap();
protected HashMap _conmap = new HashMap(); protected HashMap _conmap = new HashMap();
protected Class _clientClass = Client.class; protected Class _clientClass = CherClient.class;
protected Class _clobjClass = ClientObject.class; protected Class _clobjClass = ClientObject.class;
} }
@@ -1,5 +1,5 @@
// //
// $Id: PresentsClient.java,v 1.12 2001/08/03 02:21:16 mdb Exp $ // $Id: PresentsClient.java,v 1.13 2001/08/03 02:25:49 mdb Exp $
package com.threerings.cocktail.cher.server; package com.threerings.cocktail.cher.server;
@@ -26,7 +26,7 @@ import com.threerings.cocktail.cher.server.net.*;
* not overlap with its other client duties which are called from the * not overlap with its other client duties which are called from the
* conmgr thread and therefore also need not be synchronized. * conmgr thread and therefore also need not be synchronized.
*/ */
public class Client implements Subscriber, MessageHandler public class CherClient implements Subscriber, MessageHandler
{ {
/** /**
* Initializes this client instance with the specified username and * Initializes this client instance with the specified username and
@@ -52,7 +52,7 @@ public class Client implements Subscriber, MessageHandler
public void requestFailed (int oid, ObjectAccessException cause) public void requestFailed (int oid, ObjectAccessException cause)
{ {
Log.warning("Unable to create client object " + Log.warning("Unable to create client object " +
"[client=" + Client.this + "[client=" + CherClient.this +
", error=" + cause + "]."); ", error=" + cause + "].");
} }
@@ -291,7 +291,7 @@ public class Client implements Subscriber, MessageHandler
/** /**
* Dispatch the supplied message for the specified client. * Dispatch the supplied message for the specified client.
*/ */
public void dispatch (Client client, UpstreamMessage mge); public void dispatch (CherClient client, UpstreamMessage mge);
} }
/** /**
@@ -299,7 +299,7 @@ public class Client implements Subscriber, MessageHandler
*/ */
protected static class SubscribeDispatcher implements MessageDispatcher protected static class SubscribeDispatcher implements MessageDispatcher
{ {
public void dispatch (Client client, UpstreamMessage msg) public void dispatch (CherClient client, UpstreamMessage msg)
{ {
SubscribeRequest req = (SubscribeRequest)msg; SubscribeRequest req = (SubscribeRequest)msg;
Log.info("Subscribing [client=" + client + Log.info("Subscribing [client=" + client +
@@ -314,7 +314,7 @@ public class Client implements Subscriber, MessageHandler
*/ */
protected static class UnsubscribeDispatcher implements MessageDispatcher protected static class UnsubscribeDispatcher implements MessageDispatcher
{ {
public void dispatch (Client client, UpstreamMessage msg) public void dispatch (CherClient client, UpstreamMessage msg)
{ {
UnsubscribeRequest req = (UnsubscribeRequest)msg; UnsubscribeRequest req = (UnsubscribeRequest)msg;
Log.info("Unsubscribing [client=" + client + Log.info("Unsubscribing [client=" + client +
@@ -329,7 +329,7 @@ public class Client implements Subscriber, MessageHandler
*/ */
protected static class ForwardEventDispatcher implements MessageDispatcher protected static class ForwardEventDispatcher implements MessageDispatcher
{ {
public void dispatch (Client client, UpstreamMessage msg) public void dispatch (CherClient client, UpstreamMessage msg)
{ {
ForwardEventRequest req = (ForwardEventRequest)msg; ForwardEventRequest req = (ForwardEventRequest)msg;
DEvent fevt = req.getEvent(); DEvent fevt = req.getEvent();
@@ -350,7 +350,7 @@ public class Client implements Subscriber, MessageHandler
*/ */
protected static class PingDispatcher implements MessageDispatcher protected static class PingDispatcher implements MessageDispatcher
{ {
public void dispatch (Client client, UpstreamMessage msg) public void dispatch (CherClient client, UpstreamMessage msg)
{ {
Log.info("Received client ping [client=" + client + "]."); Log.info("Received client ping [client=" + client + "].");
// send a pong response // send a pong response
@@ -368,7 +368,7 @@ public class Client implements Subscriber, MessageHandler
*/ */
protected static class LogoffDispatcher implements MessageDispatcher protected static class LogoffDispatcher implements MessageDispatcher
{ {
public void dispatch (Client client, UpstreamMessage msg) public void dispatch (CherClient client, UpstreamMessage msg)
{ {
Log.info("Client requested logoff " + Log.info("Client requested logoff " +
"[client=" + client + "]."); "[client=" + client + "].");