Redirects received messages to other sinks based on a selection algoritm
that is determined by the set of selectors provided for each of the
targettable sinks. In diagram form:
+------------------------+
|Screener |
addSink() | +---------++---------+|
------> |/-|Selector ||Sink ||
|| +---------++---------+|
|| +---------++---------+|
put() / offer() --->-|Selector ||Sink ||
|| +---------++---------+|
|| +---------++---------+|
|\-|Selector ||Sink ||
| +---------++---------+|
+------------------------+
In other words, the Screener is a generic multiway
redirector.
Care should be taken to make sure that the Selectors used can work with
the messages that will be fed through the screener (of course).
Note that the Screener is very similar to the
Multicaster Multicaster : where the multicaster sends a received message to
all connected sinks, the Screener sends it to only one sink.
Also note that the Alternator is also very similar to the
Screener screener : where the alternator decides which connected sink
should receive the message randomly, the screener does so based on a
user-provided configuration.
author: Leo Simons version: $Id: Screener.java,v 1.2 2004/03/23 13:37:58 lsimons Exp $ |