public class ForkProtocolStack extends ProtocolStack
ProtocolStack.RefCounter| Modifier and Type | Field and Description |
|---|---|
protected int |
connects |
protected java.util.concurrent.ConcurrentMap<java.lang.String,JChannel> |
fork_channels |
protected java.lang.String |
fork_stack_id |
protected int |
inits |
protected Address |
local_addr |
protected java.util.List<Protocol> |
protocols |
protected UnknownForkHandler |
unknownForkHandler |
ABOVE, BELOW, bottom_prot, channel, max_list_print_size, props_handler, singleton_transports, stopped, top_protafter_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot| Constructor and Description |
|---|
ForkProtocolStack(UnknownForkHandler unknownForkHandler,
java.util.List<Protocol> protocols,
java.lang.String fork_stack_id) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
JChannel |
get(java.lang.String fork_channel_id) |
int |
getConnects() |
java.util.concurrent.ConcurrentMap<java.lang.String,JChannel> |
getForkChannels() |
int |
getInits() |
java.util.List<Protocol> |
getProtocols()
Returns all protocols in a list, from top to bottom.
|
ForkProtocolStack |
incrInits() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
JChannel |
putIfAbsent(java.lang.String id,
JChannel fc) |
void |
remove(java.lang.String fork_channel_id) |
void |
setLocalAddress(Address addr) |
void |
startStack(java.lang.String cluster,
Address local_addr)
Start all layers.
|
void |
stopStack(java.lang.String cluster)
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.
|
void |
up(MessageBatch batch)
Sends up a multiple messages in a
MessageBatch. |
addProtocol, addProtocols, addProtocols, bottomProtocol, callAfterCreationHook, copyProtocols, createProtocol, dumpStats, dumpStats, dumpStats, findProtocol, findProtocol, findProtocol, getBottomProtocol, getChannel, getName, getSingletonTransports, getTopProtocol, getTransport, initProtocolStack, insertProtocol, insertProtocol, insertProtocol, insertProtocolAtTop, insertProtocolInStack, printProtocolSpec, printProtocolSpecAsPlainString, printProtocolSpecAsXML, removeProtocol, removeProtocol, removeProtocol, removeProtocol, removeProtocols, replaceProtocol, setChannel, setup, setup, topProtocolaccept, afterCreationHook, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getProtocolStack, getSocketFactory, getThreadFactory, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, stopprotected Address local_addr
protected final java.lang.String fork_stack_id
protected final java.util.concurrent.ConcurrentMap<java.lang.String,JChannel> fork_channels
protected final UnknownForkHandler unknownForkHandler
protected final java.util.List<Protocol> protocols
protected int inits
protected int connects
public ForkProtocolStack(UnknownForkHandler unknownForkHandler, java.util.List<Protocol> protocols, java.lang.String fork_stack_id)
public java.util.concurrent.ConcurrentMap<java.lang.String,JChannel> getForkChannels()
public JChannel get(java.lang.String fork_channel_id)
public void remove(java.lang.String fork_channel_id)
public int getInits()
public int getConnects()
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().down in class ProtocolStackpublic void setLocalAddress(Address addr)
public java.util.List<Protocol> getProtocols()
ProtocolStackgetProtocols in class ProtocolStackpublic ForkProtocolStack incrInits()
public void init()
throws java.lang.Exception
Protocolinit in class ProtocolStackjava.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic void startStack(java.lang.String cluster,
Address local_addr)
throws java.lang.Exception
ProtocolStackProtocol.start() method is called in each protocol,
from top to bottom.
Each layer can perform some initialization, e.g. create a multicast socketstartStack in class ProtocolStackjava.lang.Exceptionpublic void stopStack(java.lang.String cluster)
ProtocolStackstopStack in class ProtocolStackpublic void destroy()
ProtocolChannel.close().
Does some cleanup; after the call the VM will terminatedestroy in class ProtocolStackpublic 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().up in class ProtocolStackpublic void up(MessageBatch batch)
ProtocolMessageBatch. The sender of the batch is always the same, and so is the
destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed
messages, although the transport itself will create initial MessageBatches that contain only either OOB or
regular messages.
The default processing below sends messages up the stack individually, based on a matching criteria
(calling Protocol.accept(org.jgroups.Message)), and - if true - calls Protocol.up(org.jgroups.Event)
for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.
Subclasses should check if there are any messages destined for them (e.g. using
MessageBatch.getMatchingMessages(short,boolean)), then possibly remove and process them and finally pass
the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all
encrypted messages in the batch, not remove them, and pass the batch up when done.up in class ProtocolStackbatch - The message batchCopyright © 1998-2020 Red Hat. All Rights Reserved.