JavaGroups.JavaStack
Class ProtocolStack

java.lang.Object
  |
  +--JavaGroups.JavaStack.Protocol
        |
        +--JavaGroups.JavaStack.ProtocolStack

public class ProtocolStack
extends Protocol
implements Transport

A ProtocolStack manages a number of protocols layered above each other. It creates all protocol classes, initializes them and, when ready, starts all of them, beginning with the bottom most protocol. It also dispatches messages received from the stack to registered objects (e.g. channel, GMP) and sends messages sent by those objects down the stack.

The ProtocolStack makes use of the Configurator to setup and initialize stacks, and to detroy them again when not needed anymore.

The bottommost instance has to implement interface LowLevelCommunication. This is necessary to be able to retrieve one's own (transport specific) address, join multicast addresses etc.


Constructor Summary
ProtocolStack(JChannel channel, java.lang.String setup_string)
           
 
Method Summary
 void Destroy()
           
 void Down(Event evt)
          An event is to be sent down the stack.
 java.lang.String GetName()
           
 java.lang.Object Receive(long timeout)
           
 void Send(Message msg)
           
 void Setup()
           
 void Start()
          Start all layers.
 void StartDownHandler()
          Used internally.
 void StartUpHandler()
          Used internally.
 void StartWork()
          Override with null functionality: we don't need any threads to be started !
 void Stop()
          Passes a STOP event down the stack, waits for the STOP_OK event from the bottom layer.
 void StopInternal()
          Used internally.
 void StopWork()
          Override with null functionality: we don't need any threads to be started !
 void Up(Event evt)
          An event was received from the layer below.
 
Methods inherited from class JavaGroups.JavaStack.Protocol
GetDownProtocol, GetProperties, GetUpProtocol, PassDown, PassUp, ProvidedDownServices, ProvidedUpServices, RequiredDownServices, RequiredUpServices, Reset, SetDownProtocol, SetProperties, SetProtocolStack, SetUpProtocol
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolStack

public ProtocolStack(JChannel channel,
                     java.lang.String setup_string)
Method Detail

Setup

public void Setup()
           throws java.lang.Exception

Destroy

public void Destroy()
             throws java.lang.Exception

Start

public void Start()
           throws java.lang.Exception
Start all layers. A START event is sent from the bottom layer up the stack. Each layer can perform some initialization.

StartUpHandler

public void StartUpHandler()
Description copied from class: Protocol
Used internally. If overridden, call parent's method first
Overrides:
StartUpHandler in class Protocol

StartDownHandler

public void StartDownHandler()
Description copied from class: Protocol
Used internally. If overridden, call parent's method first
Overrides:
StartDownHandler in class Protocol

Stop

public void Stop()
Passes a STOP event down the stack, waits for the STOP_OK event from the bottom layer. Clears all message queues

StopInternal

public void StopInternal()
Description copied from class: Protocol
Used internally. If overridden, call parent's method first
Overrides:
StopInternal in class Protocol

Send

public void Send(Message msg)
          throws java.lang.Exception
Specified by:
Send in interface Transport

Receive

public java.lang.Object Receive(long timeout)
                         throws java.lang.Exception
Specified by:
Receive in interface Transport

GetName

public java.lang.String GetName()
Overrides:
GetName in class Protocol

Up

public void Up(Event evt)
Description copied from class: Protocol
An event was received from the layer below. Usually the current layer will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally the event is either a) discarded, or b) an event is sent down the stack using PassDown or c) the event (or another event) is sent up the stack using PassUp.
Overrides:
Up in class Protocol

Down

public void Down(Event evt)
Description copied from class: Protocol
An event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack using PassDown. In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack using PassUp.
Overrides:
Down in class Protocol

StartWork

public void StartWork()
Override with null functionality: we don't need any threads to be started !

StopWork

public void StopWork()
Override with null functionality: we don't need any threads to be started !