public class FORK extends Protocol
Modifier and Type | Class and Description |
---|---|
static class |
FORK.ForkHeader |
Modifier and Type | Field and Description |
---|---|
protected String |
config |
protected ConcurrentMap<String,Protocol> |
fork_stacks |
static short |
ID |
Constructor and Description |
---|
FORK() |
Modifier and Type | Method and Description |
---|---|
Protocol |
createForkStack(String fork_stack_id,
ProtocolStack stack,
boolean replace_existing,
List<Protocol> protocols)
Creates a new fork-stack from protocols and adds it into the hashmap of fork-stack (key is fork_stack_id).
|
protected void |
createForkStacks(String config,
boolean replace_existing) |
protected static List<Protocol> |
createProtocols(ProtocolStack stack,
List<ProtocolConfiguration> protocol_configs)
Creates a fork-stack from the configuration, initializes all protocols (setting values),
sets the protocol stack as top protocol, connects the protocols and calls init() on them.
|
Protocol |
get(String fork_stack_id) |
int |
getForkStacks() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
Protocol |
putIfAbsent(String fork_stack_id,
Protocol prot) |
Object |
up(Event evt)
An event was received from the layer below.
|
void |
up(MessageBatch batch)
Sends up a multiple messages in a
MessageBatch . |
accept, destroy, down, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, stop
public static short ID
protected String config
protected final ConcurrentMap<String,Protocol> fork_stacks
public int getForkStacks()
public void init() throws Exception
Protocol
public Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.public void up(MessageBatch batch)
Protocol
MessageBatch
. 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.protected void createForkStacks(String config, boolean replace_existing) throws Exception
Exception
public Protocol createForkStack(String fork_stack_id, ProtocolStack stack, boolean replace_existing, List<Protocol> protocols) throws Exception
fork_stack_id
- The key under which the new fork-stack should be added to the fork-stacks hashmapstack
- The protocol stack under which to create the protocolsreplace_existing
- If true, and existing fork-stack is simply replaced (de-initializing it first).
Otherwise, if the stack already exists, the new fork-stack will not be created.protocols
- A list of protocols from bottom to top to be inserted. They will be sandwiched
between ForkProtocolStack (top) and ForkProtocol (bottom). The list can be empty (or null) in
which case we won't create any protocols, but still have a separate fork-stack inserted.Exception
protected static List<Protocol> createProtocols(ProtocolStack stack, List<ProtocolConfiguration> protocol_configs) throws Exception
Exception
Copyright © 2014 JBoss, a division of Red Hat. All rights reserved.