next up previous contents
Next: Initialization and de-initialization of Up: The JChannel protocol stack Previous: Class Protocol

   
Construction of the protocol stack

When a new JChannel is created, it instantiates a ProtocolStack object, giving it the property string and a reference to itself as arguments, which the ProtocolStack object stores in its instance variables: it will use the JChannel reference to pass messages up to the JChannel, and the property string to setup and configure the protocols.

After creating the protocol stack object, JChannel calls method Setup on it. This triggers a whole chain of actions on the side of the stack object, at the end of which the ProtocolStack will consist of list of protocol layers, connected with their neighboring layers, with queues set up and threads waiting to receive messages for processing. The ProtocolStack does not do this work itself, but it calls Configurator.SetupProtocolStack to do so. This method parses the property string, instantiates layers represented by the Java classes expressed by the colon-separated string, sets the arguments in each layer, connects the layers (up_prot, down_prot) and returns a reference to the topmost layer. The ProtocolStack then sets the up_prot instance variable of the topmost layer to point to itself, so that it will receive all messages, which it will pass on to the JChannel. Note that messages are passed down by the JChannel using ProtocolStack's Down method (see fig. 4.1). Finally, the ProtocolStack.Setup method starts the protocol stack by calling Configurator.StartProtocolStack with a reference to the bottommost layer as argument. For initialization and de-initialization of the protocol stack see 4.1.6.


next up previous contents
Next: Initialization and de-initialization of Up: The JChannel protocol stack Previous: Class Protocol

1999-12-13