Class prominence.msg.Router
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prominence.msg.Router

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----prominence.msg.Router

public class Router
extends Thread
A class that reads messages from a RoutingInputStream and forwards them on the MessageOutputs specified in the message routing header.
See Also:
Demultiplexer

Variable Index

 o i
The RoutingInputStream from which messages are read.
 o routes
The message routing table.

Constructor Index

 o Router(RoutingInputStream)
Creates a new Router reading from a specified stream.

Method Index

 o broadcast(byte[])
Broadcasts a message to all streams registered in the routing table.
 o deregister(String)
Deregisters a particular target name.
 o multicast(String[], byte[])
Broadcasts a message to a specified list of recipients.
 o register(String, MessageOutput)
Registers a MessageOutput as the destination for messages to a particular target.
 o run()
Routes messages from the RoutingInputStream to the MessageOutputs identified by their routing headers.

Variables

 o i
  protected RoutingInputStream i
The RoutingInputStream from which messages are read.
 o routes
  protected Hashtable routes
The message routing table. Maps from routing names to MessageOutputs.

Constructors

 o Router
  public Router(RoutingInputStream i)
Creates a new Router reading from a specified stream.
Parameters:
i - The RoutingInputStream from which messages should be read

Methods

 o register
  public void register(String client,
                       MessageOutput o)
Registers a MessageOutput as the destination for messages to a particular target.
Parameters:
client - The client name that is to be routed
o - The destination for such messages
 o deregister
  public void deregister(String client)
Deregisters a particular target name.
Parameters:
client - The client name that is to be deregistered
 o run
  public void run()
Routes messages from the RoutingInputStream to the MessageOutputs identified by their routing headers.

This method is called by a new thread when the superclass start() method is called.

Overrides:
run in class Thread
See Also:
start
 o broadcast
  protected void broadcast(byte buffer[])
Broadcasts a message to all streams registered in the routing table.
Parameters:
buffer - The message to be broadcast
 o multicast
  protected void multicast(String dst[],
                           byte buffer[])
Broadcasts a message to a specified list of recipients.
Parameters:
dst - a List of recipient names
buffer - The message to be broadcast

All Packages  Class Hierarchy  This Package  Previous  Next  Index