public class Cell<T> extends java.lang.Object implements PauseReason, EventPublisher
| Modifier and Type | Class and Description |
|---|---|
class |
Cell.BlockingSubscriber |
| Modifier and Type | Field and Description |
|---|---|
static Event |
messageAvailable |
static int |
MSG_AVAILABLE |
static int |
SPACE_AVAILABLE |
static Event |
spaceAvailble |
static int |
TIMED_OUT |
static Event |
timedOut |
| Constructor and Description |
|---|
Cell() |
| Modifier and Type | Method and Description |
|---|---|
void |
addMsgAvailableListener(EventSubscriber msgSub) |
void |
addSpaceAvailableListener(EventSubscriber spcSub) |
T |
get() |
T |
get(EventSubscriber eo)
Non-blocking, nonpausing get.
|
T |
get(long timeoutMillis) |
T |
getb()
retrieve a message, blocking the thread indefinitely.
|
T |
getb(long timeoutMillis)
retrieve a msg, and block the Java thread for the time given.
|
T |
getnb()
Get, don't pause or block.
|
boolean |
hasMessage() |
boolean |
hasSpace() |
boolean |
isValid(Task t)
True if the given task's reason for pausing is still valid.
|
void |
put(T msg) |
boolean |
put(T msg,
EventSubscriber eo)
Non-blocking, nonpausing put.
|
boolean |
put(T msg,
int timeoutMillis) |
void |
putb(T msg) |
void |
putb(T msg,
long timeoutMillis) |
boolean |
putnb(T msg) |
void |
removeMsgAvailableListener(EventSubscriber msgSub) |
void |
removeSpaceAvailableListener(EventSubscriber spcSub) |
java.lang.String |
toString() |
public static final int SPACE_AVAILABLE
public static final int MSG_AVAILABLE
public static final int TIMED_OUT
public static final Event spaceAvailble
public static final Event messageAvailable
public static final Event timedOut
public T get(EventSubscriber eo)
eo - . If non-null (and if there is no message), registers this observer. The
observer is notified with a MessageAvailable event when a put() is done.public boolean put(T msg, EventSubscriber eo)
eo - . If non-null, registers this observer and calls it with an
SpaceAvailable event when there's space.public T getnb()
public void addSpaceAvailableListener(EventSubscriber spcSub)
public void removeSpaceAvailableListener(EventSubscriber spcSub)
public void addMsgAvailableListener(EventSubscriber msgSub)
public void removeMsgAvailableListener(EventSubscriber msgSub)
public boolean putnb(T msg)
public void putb(T msg)
public void putb(T msg, long timeoutMillis)
public boolean hasMessage()
public boolean hasSpace()
public T getb()
public T getb(long timeoutMillis)
millis - . max wait timepublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isValid(Task t)
PauseReasonisValid in interface PauseReason