Package io.javago
Class InputChannelCase<T>
java.lang.Object
io.javago.InputChannelCase<T>
- Type Parameters:
 T- the type of messages handled by the input channel
- All Implemented Interfaces:
 Runnable
The 
InputChannelCase class is used by the Selector class to create a case that is run when a message
 is received from the case's channel.
 It implements the Runnable interface and allows a callback to be run when a message is received.
 Additionally, it sends an identifier to a specified output channel before and after executing the callback.- 
Constructor Summary
ConstructorsConstructorDescriptionInputChannelCase(InputChannel<T> inputChannel, Consumer<T> callback, OutputChannel<Integer> toSelector, int id, AtomicBoolean closed) Constructs anInputChannelCasewith the specified input channel, callback, output channel, identifier, and closed state. - 
Method Summary
 
- 
Constructor Details
- 
InputChannelCase
public InputChannelCase(InputChannel<T> inputChannel, Consumer<T> callback, OutputChannel<Integer> toSelector, int id, AtomicBoolean closed) Constructs anInputChannelCasewith the specified input channel, callback, output channel, identifier, and closed state.- Parameters:
 inputChannel- the input channel from which messages are receivedcallback- the consumer to be executed when a message is receivedtoSelector- the output channel to send the identifierid- the identifier to be sent to the output channelclosed- the atomic boolean indicating the closed state
 
 - 
 - 
Method Details
- 
run
public void run()Runs the input channel case. It receives a message from the input channel and executes the callback. If the input channel is closed or the thread is interrupted, the callback is executed immediately which will close its associatedSelectorobject if it exists. The identifier is sent to the output channel before and after executing the callback.- Specified by:
 runin interfaceRunnable- Throws:
 NoSuchElementException- if the channel is closed and empty
 
 -