Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry.messaging
Class MessageDispatch

    java.lang.Object
      rice.pastry.messaging.MessageDispatch

All Implemented Interfaces:
  Destructable

    public class MessageDispatch

extends java.lang.Object
implements Destructable

An object which remembers the mapping from names to MessageReceivers and dispatches messages by request. For consistent routing, modified to only deliver messages to applications if the PastryNode.isReady(). It will still deliver messages to any non-PastryAppl because these "services" may be needed to boot the node into the ring. Any messages to a PastryAppl will be buffered until the node goes ready. TODO: We need to make it explicit which apps can receive messages before PastryNode.isReady().

Version:
  $Id: MessageDispatch.java 3613 2007-02-15 14:45:14Z jstewart $
Author:
  Jeff Hoye, Andrew Ladd

Field Summary
`protected PastryNode` | `localNode`
`protected Logger` | `logger`

Constructor Summary
`MessageDispatch(PastryNode pn)` Constructor.

Method Summary
`void` | `destroy()`
`boolean` | `dispatchMessage(Message msg)` Dispatches a message to the appropriate receiver.
`boolean` | `dispatchMessage(RawMessageDelivery msg)`
`PastryAppl` | `getDestination(Message msg)`
`PastryAppl` | `getDestinationByAddress(int addr)`
`void` | `registerReceiver(int address, PastryAppl receiver)` Registers a receiver with the mail service.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### localNode

    protected PastryNode localNode

### logger

    protected Logger logger

Constructor Detail

### MessageDispatch

    public MessageDispatch(PastryNode pn)

  Constructor.

Method Detail

### registerReceiver

    public void registerReceiver(int address,
                                 PastryAppl receiver)

  Registers a receiver with the mail service.

  Parameters:
    `name` - a name for a receiver.
    `receiver` - the receiver.

### getDestination

    public PastryAppl getDestination(Message msg)

### getDestinationByAddress

    public PastryAppl getDestinationByAddress(int addr)

### dispatchMessage

    public boolean dispatchMessage(Message msg)

  Dispatches a message to the appropriate receiver. It will buffer the message under the following conditions: 1) The MessageReceiver is not yet registered. 2) The MessageReceiver is a PastryAppl, and localNode.isReady() == false

  Parameters:
    `msg` - the message.
  Returns:
    true if message could be dispatched, false otherwise.

### dispatchMessage

    public boolean dispatchMessage(RawMessageDelivery msg)

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Destructable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.