public class STATE_TRANSFER extends Protocol implements ProcessingQueue.Handler<Address>
STATE
,
STATE_SOCK
Modifier and Type | Class and Description |
---|---|
static class |
STATE_TRANSFER.StateHeader
Wraps data for a state request/response.
|
Modifier and Type | Field and Description |
---|---|
protected double |
avg_state_size |
protected boolean |
flushProtocolInStack |
protected Address |
local_addr |
protected java.util.List<Address> |
members |
protected java.util.concurrent.atomic.AtomicLong |
num_bytes_sent |
protected java.util.concurrent.atomic.AtomicInteger |
num_state_reqs |
protected long |
start |
protected ProcessingQueue<Address> |
state_requesters
List of members requesting state
|
protected long |
stop |
protected View |
view |
protected boolean |
waiting_for_state_response
set to true while waiting for a STATE_RSP
|
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
STATE_TRANSFER() |
Modifier and Type | Method and Description |
---|---|
void |
closeBarrierAndSuspendStable() |
protected void |
closeHoleFor(Address member) |
protected Address |
determineCoordinator()
Return the first element of members which is not me.
|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
double |
getAverageStateSize() |
long |
getNumberOfStateBytesSent() |
int |
getNumberOfStateRequests() |
protected void |
getStateFromApplication(Address requester,
Digest digest) |
void |
handle(Address state_requester) |
protected void |
handleException(java.lang.Throwable exception) |
protected void |
handleStateReq(Address requester) |
protected void |
handleStateRsp(Digest digest,
Address sender,
byte[] state)
Set the digest and the send the state up to the application
|
protected void |
handleViewChange(View v) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
protected boolean |
isDigestNeeded()
When FLUSH is used we do not need to pass digests between members
see JGroups/doc/design/PartialStateTransfer.txt see
JGroups/doc/design/FLUSH.txt
|
void |
openBarrier() |
void |
openBarrierAndResumeStable() |
protected void |
punchHoleFor(Address member) |
java.util.List<java.lang.Integer> |
requiredDownServices()
List of events that are required to be answered by some layer below
|
void |
resetStats() |
void |
resumeStable() |
protected void |
sendException(Address requester,
java.lang.Throwable exception) |
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.
|
accept, afterCreationHook, destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, up
protected long start
protected long stop
protected final java.util.concurrent.atomic.AtomicInteger num_state_reqs
protected final java.util.concurrent.atomic.AtomicLong num_bytes_sent
protected double avg_state_size
protected Address local_addr
protected volatile View view
protected final java.util.List<Address> members
protected final ProcessingQueue<Address> state_requesters
protected volatile boolean waiting_for_state_response
protected boolean flushProtocolInStack
public int getNumberOfStateRequests()
public long getNumberOfStateBytesSent()
public double getAverageStateSize()
public java.util.List<java.lang.Integer> requiredDownServices()
Protocol
requiredDownServices
in class Protocol
public void resetStats()
resetStats
in class Protocol
public void init() throws java.lang.Exception
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 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 flushedpublic void closeBarrierAndSuspendStable()
public void openBarrierAndResumeStable()
public void openBarrier()
public void resumeStable()
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()
.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()
.protected boolean isDigestNeeded()
protected void punchHoleFor(Address member)
protected void closeHoleFor(Address member)
protected Address determineCoordinator()
protected void handleViewChange(View v)
protected void handleException(java.lang.Throwable exception)
public void handle(Address state_requester)
handle
in interface ProcessingQueue.Handler<Address>
protected void handleStateReq(Address requester)
protected void sendException(Address requester, java.lang.Throwable exception)
Copyright © 1998-2020 Red Hat. All Rights Reserved.