a selector is a event bus, reactor, or event aggregator.
This link has been bookmarked by 3 people . It was first bookmarked on 14 Oct 2008, by someone privately.
-
11 Aug 09
-
the most important being the new
SelectableChannelandSelectorclasses. A channel represents a means of communication between a client and a server. A selector is analogous to a Windows message loop, in which the selector captures the various events from different clients and dispatches them to their respective event handlers. -
The principal force behind the design of NIO is the Reactor design pattern.
-
allows event-driven applications to demultiplex and dispatch service requests,
-
The Observer pattern is associated with a single source of events, however, whereas the Reactor pattern is associated with multiple sources of events.
-
Add Sticky Notea
Selectorclass is a multiplexor ofChannels. It demultiplexes incoming client requests and dispatches them to their respective request handlers. -
-
A channel represents an open connection to an entity such as a hardware device, a file, a network socket, or a program component
-

-
It is basically a wrapper around a fixed-size array with getter/setter methods that make its contents accessible.
-
The one major difference, mentioned above, is that these blocking reads and writes can be interrupted by other threads.
-
The
Selectorclass plays the role of aReactorin the Reactor pattern scenario. -
The
Selectormultiplexes events on severalSelectableChannels. EachChannelregisters events with theSelector. When events arrive from clients, theSelectordemutliplexes them and dispatches the events to the correspondingChannels. -
A
Channel's registration with theSelectoris represented by aSelectionKeyobject. -
SelectionKey.OP_ACCEPT
-
Public Stiky Notes
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.