Package org.jgrapes.io
Class NioDispatcher
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jgrapes.io.NioDispatcher
- All Implemented Interfaces:
Iterable<ComponentType>
,Runnable
,Channel
,ComponentType
,Eligible
,Manager
A helper component that provides the central hub for non blocking
I/O components.
Exactly one NioDispatcher must exist in
any tree with NioHandler
components.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onNioRegistration
(NioRegistration event) Handle the NIO registration.void
Starts this dispatcher.void
Stops the thread that is associated with this dispatcher.void
run()
Invoked once by the thread associated with the dispatcher.Methods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setName
Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
NioDispatcher
Creates a new Dispatcher.- Throws:
IOException
- if an I/O exception occurred
-
-
Method Details
-
onStart
Starts this dispatcher.A dispatcher has an associated thread that keeps it running.
- Parameters:
event
- the event
-
onStop
Stops the thread that is associated with this dispatcher.- Parameters:
event
- the event- Throws:
InterruptedException
- if the execution is interrupted
-
run
Invoked once by the thread associated with the dispatcher.Handles all events from the underlying
Selector
. -
onNioRegistration
Handle the NIO registration.- Parameters:
event
- the event- Throws:
IOException
- Signals that an I/O exception has occurred.
-