|
More information: http://www.cs.berkeley.edu/~mdw/proj/seda/ | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mdw.sandStorm.core.SelectSource
A SelectSource is an implementation of SourceIF which pulls events from the operating system via the NBIO SelectSet interface. This can be thought of as a 'shim' which turns a SelectSet into a SourceIF.
SelectSource can also "balances" the set of events returned on subsequent calls to dequeue, in order to avoid biasing the servicing of underlying O/S events to a particular order. This feature can be disabled by creating a SelectSource with the boolean flag 'do_balance'.
Constructor Summary | |
SelectSource()
Create a new empty SelectSource. |
|
SelectSource(boolean do_balance)
Create a new empty SelectSource. |
Method Summary | |
QueueElementIF[] |
blocking_dequeue_all(int timeout_millis)
Dequeue a set of elements from the SelectSource. |
QueueElementIF |
blocking_dequeue(int timeout_millis)
Dequeue the next element from the SelectSource. |
QueueElementIF[] |
blocking_dequeue(int timeout_millis,
int num)
Dequeue a set of elements from the SelectSource. |
QueueElementIF[] |
dequeue_all()
Dequeues all elements which are ready from the SelectSource. |
QueueElementIF |
dequeue()
Dequeues the next element from the SelectSource without blocking. |
QueueElementIF[] |
dequeue(int num)
Dequeues at most num elements which are ready from the SelectSource. |
void |
deregister(SelectItem sel)
Deregister a SelectItem with this SelectSource. |
SelectSet |
getSelectSet()
|
int |
numActive()
Return the number of active SelectItems registered with the SelectSource. |
int |
numRegistered()
Return the number of SelectItems registered with the SelectSource. |
void |
register(SelectItem sel)
Register a SelectItem with the SelectSource. |
int |
size()
Return the number of elements waiting in the queue (that is, which don't require a SelectSet poll operation to retrieve). |
void |
update()
Must be called if the 'events' mask of any SelectItem registered with this SelectSource changes. |
void |
update(SelectItem sel)
Must be called if the 'events' mask of this SelectItem (which must be registered with this SelectSource) changes. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public SelectSource()
public SelectSource(boolean do_balance)
do_balance
- Indicates whether this SelectSource should perform
event balancing.Method Detail |
public SelectSet getSelectSet()
public void register(SelectItem sel)
The user is allowed to modify the event flags in the SelectItem directly (say, to cause the SelectSource ignore a given SelectItem for the purposes of future calls to one of the dequeue methods). However, modifying the event flags may not be synchronous with calls to dequeue - generally because SelectSource maintains a cache of recently-received events.
Selectable
public void deregister(SelectItem sel)
public void update()
public void update(SelectItem sel)
public int numRegistered()
public int numActive()
public int size()
size
in interface SourceIF
public QueueElementIF dequeue()
dequeue
in interface SourceIF
mdw.sandStorm.api.SourceIF
QueueElementIF
on the queuepublic QueueElementIF[] dequeue_all()
dequeue_all
in interface SourceIF
mdw.sandStorm.api.SourceIF
QueueElementIF
s on the queuepublic QueueElementIF[] dequeue(int num)
dequeue
in interface SourceIF
mdw.sandStorm.api.SourceIF
num
QueueElementIF
s on the queuepublic QueueElementIF blocking_dequeue(int timeout_millis)
blocking_dequeue
in interface SourceIF
public QueueElementIF[] blocking_dequeue_all(int timeout_millis)
blocking_dequeue_all
in interface SourceIF
mdw.sandStorm.api.SourceIF
timeout_millis
- if timeout_millis is 0
, this method
will be non-blocking and will return right away, whether or not
any elements are pending on the queue. If timeout_millis is
-1
, this method blocks forever until something is
available. If timeout_millis is positive, this method will wait
about that number of milliseconds before returning, but possibly a
little more.QueueElementIF
's. This array will
be null if no elements were pending.public QueueElementIF[] blocking_dequeue(int timeout_millis, int num)
blocking_dequeue
in interface SourceIF
|
More information: http://www.cs.berkeley.edu/~mdw/proj/seda/ | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |