|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javagroups.stack.Protocol
org.javagroups.stack.MessageProtocol
org.javagroups.stack.RpcProtocol
org.javagroups.protocols.FLUSH
The task of the FLUSH protocol is to flush all pending messages out of the system. This is done before a view change by stopping all senders and then agreeing on what messages should be delivered in the current view (before switching to the new view). A coordinator broadcasts a FLUSH message. The message contains an array of the highest sequence number for each member as seen by the coordinator so far. Each member responds with its highest sequence numbers seen so far (for each member): if its sequence number for a member P is higher than the one sent by the coordinator, it will append the messages apparently not received by the coordinator to its reply. The coordinator (when all replies have been received), computes for each member the lowest and highest sequence number and re-broadcasts messages accordingly (using ACKs rather then NAKs to ensure reliable delivery).
Example:
FLUSH ---> (p=10, q=22, r=7) <-- (p=10, q=20, r=7) (did not receive 2 messages from q) <-- (p=12, q=23, r=7) (attached are messages p11, p12, and q23) <-- (p=10, q=22, r=8) (attached is message r8) --------------------- min: 11 21 8 max: 12 23 8The coordinator now computes the range for each member and re-broadcasts messages p11, p12, q21, q22, q23 and r8. This is essentially the exclusive min and inclusive max of all replies. Note that messages p11, p12 and q23 were not received by the coordinator itself before. They were only returned as result of the FLUSH replies and the coordinator now re-broadcasts them.
Field Summary |
Fields inherited from class org.javagroups.stack.MessageProtocol |
_corr, members |
Fields inherited from class org.javagroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, down_thread_prio, observer, props, stack, up_handler, up_prot, up_queue, up_thread, up_thread_prio |
Constructor Summary | |
FLUSH()
|
Method Summary | |
java.lang.String |
getName()
|
boolean |
handleDownEvent(Event evt)
Callback. |
Digest |
handleFlush(java.util.Vector flush_dests,
long[] highest_seqnos)
Called by coordinator running the FLUSH protocol. |
boolean |
handleUpEvent(Event evt)
Callback. |
java.util.Vector |
providedUpServices()
List of events that are provided to layers above (they will be handled when sent down from above). |
void |
receiveDownEvent(Event evt)
The default handling adds the event to the down-queue where events are handled in order of addition by a thread. |
java.util.Vector |
requiredDownServices()
List of events that are required to be answered by some layer below. |
boolean |
setProperties(java.util.Properties props)
Configures the protocol initially. |
void |
start()
This method is called on a Channel.connect(String) . |
Methods inherited from class org.javagroups.stack.RpcProtocol |
callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, handle |
Methods inherited from class org.javagroups.stack.MessageProtocol |
castMessage, down, sendMessage, stop, up, updateView |
Methods inherited from class org.javagroups.stack.Protocol |
destroy, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, init, passDown, passUp, providedDownServices, receiveUpEvent, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setUpProtocol, startDownHandler, startUpHandler, stopInternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FLUSH()
Method Detail |
public java.lang.String getName()
getName
in class RpcProtocol
public java.util.Vector providedUpServices()
Protocol
providedUpServices
in class Protocol
public java.util.Vector requiredDownServices()
Protocol
requiredDownServices
in class Protocol
public 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 MessageProtocol
java.lang.Exception
public Digest handleFlush(java.util.Vector flush_dests, long[] highest_seqnos)
handleFlush()
checks for each member its
own highest seqno seen for that member. If it is higher than the one seen by the coordinator,
all higher messages are attached to the return value (a message digest).
flush_dests
- The members to which this message is sent. Processes not in this list just
ignore the handleFlush() message.highest_seqnos
- The highest sequence numbers (order corresponding to membership) as seen
by coordinator.
highest_seqnos
,
the missing messages are added to the message digest as well. This allows the
coordinator to re-broadcast missing messages.public boolean handleUpEvent(Event evt)
Do not use PassUp
in this method as the event is passed up
by default by the superclass after this method returns !
handleUpEvent
in class RpcProtocol
public boolean handleDownEvent(Event evt)
Do not use PassDown
in this method as the event is passed down
by default by the superclass after this method returns !
handleDownEvent
in class RpcProtocol
public void receiveDownEvent(Event evt)
receiveDownEvent
in class Protocol
public boolean setProperties(java.util.Properties props)
Protocol
"loopback=false;unicast_inport=4444"
setProperties
in class Protocol
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |