More information: http://www.cs.berkeley.edu/~mdw/proj/seda/

seda.sandStorm.lib.aSocket
Interface SelectSourceIF

All Superinterfaces:
SourceIF

public interface SelectSourceIF
extends SourceIF

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'.

Author:
Matt Welsh

Method Summary
 void deregister(java.lang.Object sel)
          Deregister a SelectItem with this SelectSource.
 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(java.lang.Object sel)
          Register a SelectItem with the SelectSource.
 java.lang.Object register(java.lang.Object sc, int ops)
           
 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(java.lang.Object sel)
          Must be called if the 'events' mask of this SelectItem (which must be registered with this SelectSource) changes.
 
Methods inherited from interface seda.sandStorm.api.SourceIF
blocking_dequeue_all, blocking_dequeue, blocking_dequeue, dequeue_all, dequeue, dequeue
 

Method Detail

register

public void register(java.lang.Object sel)
Register a SelectItem with the SelectSource. The SelectItem should generally correspond to a Selectable along with a set of event flags that we wish this SelectSource to test for.

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.

See Also:
Selectable

register

public java.lang.Object register(java.lang.Object sc,
                                 int ops)

deregister

public void deregister(java.lang.Object sel)
Deregister a SelectItem with this SelectSource. Note that after calling deregister, subsequent calls to dequeue may in fact return this SelectItem as a result. This is because the SelectQueue internally caches results.

update

public void update()
Must be called if the 'events' mask of any SelectItem registered with this SelectSource changes. Pushes event mask changes down to the underlying event-dispatch mechanism.

update

public void update(java.lang.Object sel)
Must be called if the 'events' mask of this SelectItem (which must be registered with this SelectSource) changes. Pushes event mask changes down to the underlying event-dispatch mechanism.

numRegistered

public int numRegistered()
Return the number of SelectItems registered with the SelectSource.

numActive

public int numActive()
Return the number of active SelectItems registered with the SelectSource. An active SelectItem is one defined as having a non-zero events interest mask.

size

public int size()
Return the number of elements waiting in the queue (that is, which don't require a SelectSet poll operation to retrieve).
Specified by:
size in interface SourceIF

More information: http://www.cs.berkeley.edu/~mdw/proj/seda/