|
|||||||||
| Home >> All >> org >> jgroups >> [ stack overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jgroups.stack
Class ProtocolStack

java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.stack.ProtocolStack
- All Implemented Interfaces:
- org.jgroups.Transport
- public class ProtocolStack
- extends Protocol
- implements org.jgroups.Transport
- extends Protocol
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 destroy them again when not needed anymore
| Field Summary | |
static int |
ABOVE
|
static int |
BELOW
|
private Protocol |
bottom_prot
|
private org.jgroups.JChannel |
channel
|
private Configurator |
conf
|
private java.lang.String |
setup_string
|
(package private) org.jgroups.util.Promise |
start_promise
Used to sync on START/START_OK events for start() |
(package private) org.jgroups.util.Promise |
stop_promise
used to sync on STOP/STOP_OK events for stop() |
private boolean |
stopped
|
org.jgroups.util.TimeScheduler |
timer
|
private Protocol |
top_prot
|
| Fields inherited from class org.jgroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn |
| Constructor Summary | |
ProtocolStack()
Only used by Simulator; don't use |
|
ProtocolStack(org.jgroups.JChannel channel,
java.lang.String setup_string)
|
|
| Method Summary | |
Protocol |
createProtocol(java.lang.String prot_spec)
Creates a new protocol given the protocol specification. |
void |
destroy()
This method is called on a Channel.close()> Channel.close() 55 . |
void |
down(org.jgroups.Event evt)
An event is to be sent down the stack. |
java.util.Map |
dumpStats()
|
java.lang.String |
dumpTimerQueue()
|
Protocol |
findProtocol(java.lang.String name)
Returns a given protocol or null if not found |
void |
flushEvents()
Deprecated. |
org.jgroups.Channel |
getChannel()
|
java.lang.String |
getName()
|
java.util.Vector |
getProtocols()
Returns all protocols in a list, from top to bottom. |
void |
insertProtocol(Protocol prot,
int position,
java.lang.String neighbor_prot)
Inserts an already created (and initialized) protocol into the protocol list. |
java.lang.String |
printProtocolSpec(boolean include_properties)
Prints the names of the protocols, from the bottom to top. |
java.lang.String |
printProtocolSpecAsXML()
|
java.lang.Object |
receive(long timeout)
|
protected void |
receiveUpEvent(org.jgroups.Event evt)
Internal method, should not be called by clients. |
void |
removeProtocol(java.lang.String prot_name)
Removes a protocol from the stack. |
void |
send(org.jgroups.Message msg)
|
void |
setup()
|
void |
startDownHandler()
Used internally. |
void |
startStack()
Start all layers. |
void |
startUpHandler()
Used internally. |
void |
startWork()
Override with null functionality: we don't need any threads to be started ! |
void |
stopInternal()
Used internally. |
void |
stopStack()
Iterates through all the protocols from top to bottom and does the following: Waits until all messages in the down queue have been flushed (ie., size is 0) Calls stop() on the protocol |
void |
stopWork()
Override with null functionality: we don't need any threads to be started ! |
void |
up(org.jgroups.Event evt)
An event was received from the layer below. |
| Methods inherited from class org.jgroups.stack.Protocol |
downThreadEnabled, enableStats, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setObserver, setProperties, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, start, statsEnabled, stop, upThreadEnabled |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
top_prot
private Protocol top_prot
bottom_prot
private Protocol bottom_prot
conf
private final Configurator conf
setup_string
private java.lang.String setup_string
channel
private org.jgroups.JChannel channel
stopped
private boolean stopped
timer
public final org.jgroups.util.TimeScheduler timer
start_promise
org.jgroups.util.Promise start_promise
- Used to sync on START/START_OK events for start()
stop_promise
org.jgroups.util.Promise stop_promise
- used to sync on STOP/STOP_OK events for stop()
ABOVE
public static final int ABOVE
- See Also:
- Constant Field Values
BELOW
public static final int BELOW
- See Also:
- Constant Field Values
| Constructor Detail |
ProtocolStack
public ProtocolStack(org.jgroups.JChannel channel, java.lang.String setup_string) throws org.jgroups.ChannelException
ProtocolStack
public ProtocolStack()
- Only used by Simulator; don't use
| Method Detail |
getChannel
public org.jgroups.Channel getChannel()
getProtocols
public java.util.Vector getProtocols()
- Returns all protocols in a list, from top to bottom. These are not copies of protocols,
so modifications will affect the actual instances !
dumpStats
public java.util.Map dumpStats()
dumpTimerQueue
public java.lang.String dumpTimerQueue()
printProtocolSpec
public java.lang.String printProtocolSpec(boolean include_properties)
- Prints the names of the protocols, from the bottom to top. If include_properties is true,
the properties for each protocol will also be printed.
printProtocolSpecAsXML
public java.lang.String printProtocolSpecAsXML()
setup
public void setup()
throws java.lang.Exception
createProtocol
public Protocol createProtocol(java.lang.String prot_spec) throws java.lang.Exception
- Creates a new protocol given the protocol specification.
insertProtocol
public void insertProtocol(Protocol prot, int position, java.lang.String neighbor_prot) throws java.lang.Exception
- Inserts an already created (and initialized) protocol into the protocol list. Sets the links
to the protocols above and below correctly and adjusts the linked list of protocols accordingly.
Note that this method may change the value of top_prot or bottom_prot.
removeProtocol
public void removeProtocol(java.lang.String prot_name) throws java.lang.Exception
- Removes a protocol from the stack. Stops the protocol and readjusts the linked lists of
protocols.
findProtocol
public Protocol findProtocol(java.lang.String name)
- Returns a given protocol or null if not found
destroy
public void destroy()
- Description copied from class:
Protocol - This method is called on a Channel.close()>
Channel.close()55 . Does some cleanup; after the call the VM will terminate
startStack
public void startStack()
throws java.lang.Exception
- Start all layers. The
Protocol.start()55 method is called in each protocol, from top to bottom. Each layer can perform some initialization, e.g. create a multicast socket
startUpHandler
public void startUpHandler()
- Description copied from class:
Protocol - Used internally. If overridden, call this method first. Only creates the up_handler thread
if down_thread is true
- Overrides:
startUpHandlerin classProtocol
startDownHandler
public void startDownHandler()
- Description copied from class:
Protocol - Used internally. If overridden, call this method first. Only creates the down_handler thread
if down_thread is true
- Overrides:
startDownHandlerin classProtocol
stopStack
public void stopStack()
- Iterates through all the protocols from top to bottom and does the following:
- Waits until all messages in the down queue have been flushed (ie., size is 0)
- Calls stop() on the protocol
flushEvents
public void flushEvents()
- Deprecated.
- Not needed anymore, just left in here for backwards compatibility with JBoss AS
- Not needed anymore, just left in here for backwards compatibility with JBoss AS
stopInternal
public void stopInternal()
- Description copied from class:
Protocol - Used internally. If overridden, call parent's method first
- Overrides:
stopInternalin classProtocol
send
public void send(org.jgroups.Message msg) throws java.lang.Exception
- Specified by:
sendin interfaceorg.jgroups.Transport
receive
public java.lang.Object receive(long timeout) throws java.lang.Exception
- Specified by:
receivein interfaceorg.jgroups.Transport
getName
public java.lang.String getName()
up
public void up(org.jgroups.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 usingpassUp().
down
public void down(org.jgroups.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 usingpassUp().
receiveUpEvent
protected void receiveUpEvent(org.jgroups.Event evt)
- Description copied from class:
Protocol - Internal method, should not be called by clients. Used by ProtocolStack. I would have
used the 'friends' modifier, but this is available only in C++ ... If the up_handler thread
is not available (down_thread == false), then directly call the up() method: we will run on the
caller's thread (e.g. the protocol layer below us).
- Overrides:
receiveUpEventin classProtocol
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 !
|
|||||||||
| Home >> All >> org >> jgroups >> [ stack overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC