public class ClientDObjectMgr extends Object implements DObjectManager, Runnable
| Constructor and Description |
|---|
ClientDObjectMgr(Communicator comm,
Client client)
Constructs a client distributed object manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Called when the client is cleaned up due to having disconnected from the server.
|
boolean |
isManager(DObject object)
Returns true if this distributed object manager is the authoritative manager for the
specified distributed object, or false if we are only providing a proxy to the object.
|
void |
postEvent(DEvent event)
Posts a distributed object event into the system.
|
void |
processMessage(Message msg)
Called by the communicator when a message arrives from the network layer.
|
void |
registerFlushDelay(Class<?> objclass,
long delay)
Registers an object flush delay.
|
void |
removedLastSubscriber(DObject obj,
boolean deathWish)
When a distributed object removes its last subscriber, it will call this function to let the
object manager know.
|
void |
run()
Invoked on the main client thread to process any newly arrived messages that we have waiting
in our queue.
|
<T extends DObject> |
subscribeToObject(int oid,
Subscriber<T> target)
Requests that the specified subscriber be subscribed to the object identified by the
supplied object id.
|
<T extends DObject> |
unsubscribeFromObject(int oid,
Subscriber<T> target)
Requests that the specified subscriber be unsubscribed from the object identified by the
supplied object id.
|
public ClientDObjectMgr(Communicator comm, Client client)
comm - a communicator instance by which it can communicate with the server.client - a reference to the client that is managing this whole communications and event
dispatch business.public boolean isManager(DObject object)
DObjectManagerisManager in interface DObjectManagerpublic <T extends DObject> void subscribeToObject(int oid, Subscriber<T> target)
DObjectManagersubscribeToObject in interface DObjectManageroid - The object id of the distributed object to which subscription is desired.target - The subscriber to be subscribed.Subscriber.objectAvailable(T),
Subscriber.requestFailed(int, com.threerings.presents.dobj.ObjectAccessException)public <T extends DObject> void unsubscribeFromObject(int oid, Subscriber<T> target)
DObjectManagerunsubscribeFromObject in interface DObjectManageroid - The object id of the distributed object from which unsubscription is desired.target - The subscriber to be unsubscribed.public void postEvent(DEvent event)
DObjectManagerAttributeChangedEvent can be constructed and posted directly. This
is true for all event types and is useful for situations where one doesn't have access to
the object in question, but needs to affect some event.
This event will be forwarded to the ultimate manager of the object (on the client, this means it will be forwarded to the server) where it will be checked for validity and then applied to the object and dispatched to all its subscribers.
postEvent in interface DObjectManagerevent - The event to be dispatched.public void removedLastSubscriber(DObject obj, boolean deathWish)
DObjectManagerremovedLastSubscriber in interface DObjectManagerpublic void registerFlushDelay(Class<?> objclass, long delay)
public void processMessage(Message msg)
public void run()
public void cleanup()
Copyright © 2015. All rights reserved.