public class ProtocolStack extends Protocol implements Transport
The ProtocolStack makes use of the Configurator to setup and initialize stacks, and to destroy them again when not needed anymore
| Constructor and Description |
|---|
ProtocolStack()
Only used by Simulator; don't use
|
ProtocolStack(JChannel channel,
java.lang.String setup_string) |
| Modifier and Type | Method and Description |
|---|---|
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(). |
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
java.util.Map<java.lang.String,java.lang.Object> |
dumpStats() |
java.util.Map<java.lang.String,java.lang.Object> |
dumpStats(java.lang.String protocol_name) |
java.lang.String |
dumpTimerQueue()
Deprecated.
Use
TP.getTimer() instead to fetch the timer from the
transport and then invoke the method on it |
Protocol |
findProtocol(java.lang.Class<?> clazz) |
Protocol |
findProtocol(java.lang.String name)
Returns a given protocol or null if not found
|
void |
flushEvents()
Deprecated.
|
Channel |
getChannel() |
java.util.Map<java.lang.Thread,java.util.concurrent.locks.ReentrantLock> |
getLocks() |
java.lang.String |
getName() |
java.util.Vector<Protocol> |
getProtocols()
Returns all protocols in a list, from top to bottom.
|
static java.util.concurrent.ConcurrentMap<java.lang.String,Tuple<TP,java.lang.Short>> |
getSingletonTransports() |
ThreadFactory |
getThreadFactory()
Deprecated.
Use
Protocol.getThreadFactory() instead |
static ThreadFactory |
getTimerThreadFactory()
Deprecated.
|
int |
getTimerThreads()
Deprecated.
Use
TP.getTimer() to fetch the timer and call getCorePoolSize() directly |
TP |
getTransport()
Returns the bottom most protocol
|
void |
insertProtocol(Protocol prot,
int position,
java.lang.Class<? extends Protocol> neighbor_prot) |
void |
insertProtocol(Protocol prot,
int position,
Protocol neighbor_prot) |
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 |
printProtocolSpecAsPlainString() |
java.lang.String |
printProtocolSpecAsXML() |
java.lang.Object |
receive(long timeout) |
Protocol |
removeProtocol(java.lang.String prot_name)
Removes a protocol from the stack.
|
void |
send(Message msg) |
void |
setThreadFactory(ThreadFactory f)
Deprecated.
Use
Protocol.getThreadFactory() instead |
static void |
setTimerThreadFactory(ThreadFactory f)
Deprecated.
|
void |
setup() |
void |
startStack(java.lang.String cluster_name)
Start all layers.
|
void |
stopStack(java.lang.String cluster_name)
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
|
java.lang.Object |
up(Event evt)
An event was received from the layer below.
|
downThreadEnabled, enableStats, getDownProtocol, getProperties, getProtocolStack, getUpProtocol, init, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setProperties, setPropertiesInternal, setProtocolStack, setUpProtocol, start, statsEnabled, stop, upThreadEnabledpublic static final int ABOVE
public static final int BELOW
public ProtocolStack(JChannel channel, java.lang.String setup_string) throws ChannelException
ChannelExceptionpublic ProtocolStack()
throws ChannelException
ChannelExceptionpublic ThreadFactory getThreadFactory()
Protocol.getThreadFactory() insteadProtocolgetThreadFactory in class Protocol@Deprecated public static ThreadFactory getTimerThreadFactory()
public void setThreadFactory(ThreadFactory f)
Protocol.getThreadFactory() insteadf - public static void setTimerThreadFactory(ThreadFactory f)
TP.setTimerThreadFactory(org.jgroups.util.ThreadFactory) insteadf - public java.util.Map<java.lang.Thread,java.util.concurrent.locks.ReentrantLock> getLocks()
public Channel getChannel()
public int getTimerThreads()
TP.getTimer() to fetch the timer and call getCorePoolSize() directlypublic java.util.Vector<Protocol> getProtocols()
public TP getTransport()
getTransport in class Protocolpublic static java.util.concurrent.ConcurrentMap<java.lang.String,Tuple<TP,java.lang.Short>> getSingletonTransports()
public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
public java.util.Map<java.lang.String,java.lang.Object> dumpStats(java.lang.String protocol_name)
public java.lang.String dumpTimerQueue()
TP.getTimer() instead to fetch the timer from the
transport and then invoke the method on itpublic java.lang.String printProtocolSpec(boolean include_properties)
public java.lang.String printProtocolSpecAsXML()
public java.lang.String printProtocolSpecAsPlainString()
public void setup()
throws java.lang.Exception
java.lang.Exceptionpublic Protocol createProtocol(java.lang.String prot_spec) throws java.lang.Exception
prot_spec - The specification of the protocol. Same convention as for specifying a protocol stack.
An exception will be thrown if the class cannot be created. Example:
"VERIFY_SUSPECT(timeout=1500)"Note that no colons (:) have to be specified
java.lang.Exception - Will be thrown when the new protocol cannot be createdpublic void insertProtocol(Protocol prot, int position, java.lang.String neighbor_prot) throws java.lang.Exception
prot - The protocol to be inserted. Before insertion, a sanity check will ensure that none
of the existing protocols have the same name as the new protocol.position - Where to place the protocol with respect to the neighbor_prot (ABOVE, BELOW)neighbor_prot - The name of the neighbor protocol. An exception will be thrown if this name
is not foundjava.lang.Exception - Will be thrown when the new protocol cannot be created, or inserted.public void insertProtocol(Protocol prot, int position, java.lang.Class<? extends Protocol> neighbor_prot) throws java.lang.Exception
java.lang.Exceptionpublic void insertProtocol(Protocol prot, int position, Protocol neighbor_prot) throws java.lang.Exception
java.lang.Exceptionpublic Protocol removeProtocol(java.lang.String prot_name) throws java.lang.Exception
prot_name - The name of the protocol. Since all protocol names in a stack have to be unique
(otherwise the stack won't be created), the name refers to just 1 protocol.java.lang.Exception - Thrown if the protocol cannot be stopped correctly.public Protocol findProtocol(java.lang.String name)
public Protocol findProtocol(java.lang.Class<?> clazz)
public void destroy()
ProtocolChannel.close().
Does some cleanup; after the call the VM will terminatepublic void startStack(java.lang.String cluster_name)
throws java.lang.Exception
Protocol.start() method is called in each protocol,
from top to bottom.
Each layer can perform some initialization, e.g. create a multicast socketjava.lang.Exceptionpublic void stopStack(java.lang.String cluster_name)
public void flushEvents()
public void send(Message msg) throws java.lang.Exception
public java.lang.Object receive(long timeout)
throws java.lang.Exception
public java.lang.Object up(Event evt)
Protocoldown_prot.down() or c) the event (or another event) is sent up
the stack using up_prot.up().public java.lang.Object down(Event evt)
Protocoldown_prot.down(). 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 up_prot.up().Copyright ? 1998-2008 Bela Ban. All Rights Reserved.