Implemented object destruction; wired up some missing stuff; created a

test server to make some testing easier; various other cleanups.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@188 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-07 20:38:58 +00:00
parent b3e7f12f08
commit 782e9501d6
15 changed files with 340 additions and 54 deletions
@@ -1,5 +1,5 @@
//
// $Id: ClientDObjectMgr.java,v 1.4 2001/07/19 07:09:16 mdb Exp $
// $Id: ClientDObjectMgr.java,v 1.5 2001/08/07 20:38:58 mdb Exp $
package com.threerings.cocktail.cher.client;
@@ -75,6 +75,13 @@ public class ClientDObjectMgr
_comm.postMessage(new ForwardEventRequest(tevent));
}
// inherit documentation from the interface
public void destroyObject (int oid)
{
// forward an object destroyed event to the server
postEvent(new ObjectDestroyedEvent(oid));
}
// inherit documentation from the interface
public void removedLastSubscriber (DObject obj)
{
@@ -154,8 +161,29 @@ public class ClientDObjectMgr
return;
}
// have the object pass this event on to its subscribers
target.notifySubscribers(event);
try {
// apply the event to the object
boolean notify = event.applyToObject(target);
// if this is an object destroyed event, we need to remove the
// object from our object table
if (event instanceof ObjectDestroyedEvent) {
Log.info("Uncaching destroyed object " +
"[oid=" + target.getOid() + "].");
_ocache.remove(target.getOid());
}
// have the object pass this event on to its subscribers if
// desired
if (notify) {
target.notifySubscribers(event);
}
} catch (Exception e) {
Log.warning("Failure processing event [event=" + event +
", target=" + target + "].");
Log.logStackTrace(e);
}
}
/**
@@ -193,7 +221,19 @@ public class ClientDObjectMgr
*/
protected void notifyFailure (int oid)
{
Log.info("Get failed: " + oid);
// let the penders know that the object is not available
PendingRequest req = (PendingRequest)_penders.remove(oid);
if (req == null) {
Log.warning("Failed to get object, but no one cares?! " +
"[oid=" + oid + "].");
return;
}
for (int i = 0; i < req.targets.size(); i++) {
Subscriber target = (Subscriber)req.targets.get(i);
// and let them know that the object is in
target.requestFailed(oid, null);
}
}
/**