|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.protocols.DAISYCHAIN
public class DAISYCHAIN
Implementation of daisy chaining. Multicast messages are sent to our neighbor, which sends them to its neighbor etc. A TTL restricts the number of times a message is forwarded. The advantage of daisy chaining is that - for point-to-point transports such as TCP - we can avoid the N-1 issue: when A sends a multicast message to 10 members, it needs to send it 9 times. With daisy chaining, it sends it 1 time, and in the next round, can already send another message. This leads to much better throughput, see the ref in the JIRA.
Should be inserted just above MERGE2, in TCP based configurations. JIRA: https://jira.jboss.org/browse/JGRP-1021
Nested Class Summary | |
---|---|
static class |
DAISYCHAIN.DaisyHeader
|
Field Summary | |
---|---|
protected java.util.concurrent.Executor |
default_pool
|
protected boolean |
forward
|
protected java.util.concurrent.BlockingQueue<Message> |
forward_queue
|
protected Address |
local_addr
|
int |
msgs_forwarded
|
int |
msgs_sent
|
protected Address |
next
|
protected java.util.concurrent.Executor |
oob_pool
|
protected boolean |
running
|
protected java.util.concurrent.BlockingQueue<Message> |
send_queue
|
protected int |
view_size
|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
DAISYCHAIN()
|
Method Summary | |
---|---|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack. |
int |
getElementsInForwardQueue()
|
int |
getElementsInSendQueue()
|
protected void |
handleView(View view)
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
protected java.lang.Object |
processQueues()
|
void |
start()
This method is called on a Channel.connect(String) . |
void |
stop()
This method is called on a Channel.disconnect() . |
java.lang.Object |
up(Event evt)
An event was received from the layer below. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Address local_addr
protected Address next
protected int view_size
protected java.util.concurrent.Executor default_pool
protected java.util.concurrent.Executor oob_pool
protected java.util.concurrent.BlockingQueue<Message> send_queue
protected java.util.concurrent.BlockingQueue<Message> forward_queue
protected volatile boolean forward
protected volatile boolean running
public int msgs_forwarded
public int msgs_sent
Constructor Detail |
---|
public DAISYCHAIN()
Method Detail |
---|
public int getElementsInForwardQueue()
public int getElementsInSendQueue()
public void init() throws java.lang.Exception
Protocol
init
in class Protocol
java.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 start() throws java.lang.Exception
Protocol
Channel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.
start
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushed
stop
in class Protocol
public java.lang.Object down(Event evt)
Protocol
down_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 Protocol
public java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.
up
in class Protocol
protected java.lang.Object processQueues()
protected void handleView(View view)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |