|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.presents.util.SafeSubscriber<T>
T - the type of object to which we are subscribing.public class SafeSubscriber<T extends DObject>
A class that safely handles the asynchronous subscription to a distributed object when it is not know if the subscription will complete before the subscriber decides they no longer wish to be subscribed.
| Field Summary | |
|---|---|
protected boolean |
_active
|
protected ChangeListener[] |
_listeners
|
protected T |
_object
|
protected int |
_oid
|
protected boolean |
_pending
|
protected Subscriber<T> |
_subscriber
|
| Constructor Summary | |
|---|---|
SafeSubscriber(int oid,
Subscriber<T> subscriber,
ChangeListener... listeners)
Creates a safe subscriber for the specified distributed object which will interact with the specified subscriber. |
|
| Method Summary | |
|---|---|
boolean |
isActive()
Returns true if we are currently subscribed to our object (or in the process of obtaining a subscription). |
void |
objectAvailable(T object)
Called when a subscription request has succeeded and the object is available. |
void |
requestFailed(int oid,
ObjectAccessException cause)
Called when a subscription request has failed. |
void |
subscribe(DObjectManager omgr)
Initiates the subscription process. |
String |
toString()
|
void |
unsubscribe(DObjectManager omgr)
Terminates the object subscription. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ChangeListener[] _listeners
protected int _oid
protected Subscriber<T extends DObject> _subscriber
protected T extends DObject _object
protected boolean _active
protected boolean _pending
| Constructor Detail |
|---|
public SafeSubscriber(int oid,
Subscriber<T> subscriber,
ChangeListener... listeners)
| Method Detail |
|---|
public boolean isActive()
public void subscribe(DObjectManager omgr)
public void unsubscribe(DObjectManager omgr)
public void objectAvailable(T object)
SubscriberDObject.addListener(com.threerings.presents.dobj.ChangeListener)).
objectAvailable in interface Subscriber<T extends DObject>DObjectManager.subscribeToObject(int, com.threerings.presents.dobj.Subscriber)
public void requestFailed(int oid,
ObjectAccessException cause)
SubscriberObjectAccessException.
requestFailed in interface Subscriber<T extends DObject>DObjectManager.subscribeToObject(int, com.threerings.presents.dobj.Subscriber) public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||