The implementation of the core for all selects.
Modifiers | Name | Description |
---|---|---|
private java.util.List<SelectableChannel<? extends T>> |
channels |
|
private boolean[] |
disabledDFVs |
Since DataflowVariables should be only read once, they need to be disabled after selecting their value The array stores a boolean flag for each index, indicating, whether the channel/variable has been disabled |
private int |
numberOfChannels |
|
private java.util.Collection<SelectRequest<T>> |
pendingRequests |
Unsatisfied requests for value, each holding a list of guards and a routine to invoke once a value is available |
private java.util.Random |
position |
Constructor and description |
---|
SelectBase
(PGroup pGroup, java.util.List<SelectableChannel<? extends T>> channels) Stores the input channel and registers for the wheneverBound() event on each |
Type | Name and description |
---|---|
void |
boundNotification(int index, SelectableChannel<? extends T> channel) Invoked by the SelectCallback instances, potentially concurrently to inform about new values being available for read from channels. |
private void |
disableDFV(int currentPosition, SelectableChannel<? extends T> channel) Sets the flag in the disabledDFVs array, if the channel is a DFV |
void |
doSelect(int startIndex, SelectRequest<T> selectRequest) Invoked whenever the Select is asked for the next value. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Since DataflowVariables should be only read once, they need to be disabled after selecting their value The array stores a boolean flag for each index, indicating, whether the channel/variable has been disabled
Unsatisfied requests for value, each holding a list of guards and a routine to invoke once a value is available
Stores the input channel and registers for the wheneverBound() event on each
pGroup
- The group, the thread pool of which should be used for notification message handlerschannels
- All the input channels to select onInvoked by the SelectCallback instances, potentially concurrently to inform about new values being available for read from channels.
index
- The index of the ready channelchannel
- The channel itselfSets the flag in the disabledDFVs array, if the channel is a DFV
currentPosition
- The position to markchannel
- The channel being consideredInvoked whenever the Select is asked for the next value. Depending on the supplied startIndex value it scans all input channels and reads the first one found, which currently has a value available for read. If no input channel is ready, the supplied SelectRequest instance is registered to be notified by the wheneverBound() channel listeners.
startIndex
- The index of the channel to check first for available messages, -1 if start at a random position. Continue scanning by increasing the index, once the size is reached start from 0.selectRequest
- The request that holds the guards and expects a notification once a value is selectedCopyright © 2008–2014 Václav Pech. All Rights Reserved.