Still subscribe if the DObject is local when proxying a remote object to preserve the behavior of
DObject.setDestroyOnLastSubscriberRemoved on the proxied object git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6687 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -569,10 +569,17 @@ public abstract class PeerManager
|
||||
final DObjectAddress remote, final ResultListener<Integer> listener)
|
||||
{
|
||||
if (remote.nodeName.equals(_nodeName)) {
|
||||
_omgr.postRunnable(new Runnable() {
|
||||
public void run () {
|
||||
// Still subscribe if the DObject is local to preserve the behavior of
|
||||
// DObject.setDestroyOnLastSubscriberRemoved on the proxied object
|
||||
_omgr.subscribeToObject(remote.oid, new Subscriber<T>() {
|
||||
public void objectAvailable (T object) {
|
||||
_proxies.put(remote, new Tuple<Subscriber<?>, DObject>(this, object));
|
||||
listener.requestCompleted(remote.oid);
|
||||
}
|
||||
|
||||
public void requestFailed(int oid, ObjectAccessException oae) {
|
||||
listener.requestFailed(oae);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -618,6 +625,13 @@ public abstract class PeerManager
|
||||
return;
|
||||
}
|
||||
|
||||
// If it's local, just remove the subscriber we added and bail
|
||||
if (key.nodeName.equals(_nodeName)) {
|
||||
bits.right.removeSubscriber(bits.left);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// clear out the local object manager's proxy mapping
|
||||
_omgr.clearProxyObject(remoteOid, bits.right);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user