public class STATE_SOCK extends StreamingStateTransfer
STATE_SOCK
has the state provider create a server socket to which the state
requester connects and from which the latter reads the state.
When implementing MessageListener.getState(java.io.OutputStream)
, the state should be written in
sizeable chunks, because the underlying output stream sends 1 message / write over the socket. So if there are 1000
writes of 1 byte each, this would generate 1000 messages ! We suggest using a BufferedOutputStream
over the output stream handed to the application as argument of the callback.
When implementing the MessageListener.setState(java.io.InputStream)
callback, there is no need to use a
BufferedOutputStream
, as the input stream handed to the application already buffers incoming data
internally.STATE_TRANSFER
限定符和类型 | 类和说明 |
---|---|
protected class |
STATE_SOCK.StateProviderAcceptor |
StreamingStateTransfer.StateGetter, StreamingStateTransfer.StateHeader
限定符和类型 | 字段和说明 |
---|---|
protected java.net.InetAddress |
bind_addr |
protected java.lang.String |
bind_interface_str |
protected int |
bind_port |
protected java.net.InetAddress |
external_addr |
protected int |
external_port |
protected STATE_SOCK.StateProviderAcceptor |
spawner
Runnable that listens for state requests and spawns threads to serve those requests if socket transport is used
|
avg_state_size, buffer_size, flushProtocolInStack, local_addr, max_pool, members, num_bytes_sent, num_state_reqs, pool_thread_keep_alive, state_provider, state_requesters, thread_pool
构造器和说明 |
---|
STATE_SOCK() |
限定符和类型 | 方法和说明 |
---|---|
protected void |
close(java.lang.Object resource) |
protected STATE_SOCK.StateProviderAcceptor |
createAcceptor() |
protected Tuple<java.io.InputStream,java.lang.Object> |
createStreamToProvider(Address provider,
StreamingStateTransfer.StateHeader hdr)
Creates an InputStream to the state provider to read the state.
|
protected void |
handleConfig(java.util.Map<java.lang.String,java.lang.Object> config) |
protected void |
handleStateReq(Address requester) |
protected void |
handleViewChange(View v) |
protected void |
modifyStateResponseHeader(StreamingStateTransfer.StateHeader hdr) |
void |
stop()
This method is called on a
Channel.disconnect() . |
closeBarrierAndSuspendStable, closeHoleFor, createStreamToRequester, createThreadPool, destroy, determineCoordinator, down, getAverageStateSize, getNumberOfStateBytesSent, getNumberOfStateRequests, getStateFromApplication, getThreadPoolCompletedTasks, getThreadPoolSize, handle, handleEOF, handleException, handleStateChunk, handleStateRsp, init, isDigestNeeded, openBarrier, openBarrierAndResumeStable, punchHoleFor, requiredDownServices, resetStats, resumeStable, sendEof, sendException, setStateInApplication, start, up, useAsyncStateDelivery
accept, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, 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 java.net.InetAddress bind_addr
protected java.net.InetAddress external_addr
protected int external_port
protected java.lang.String bind_interface_str
protected int bind_port
protected volatile STATE_SOCK.StateProviderAcceptor spawner
public 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 flushedstop
在类中 StreamingStateTransfer
protected STATE_SOCK.StateProviderAcceptor createAcceptor()
protected void modifyStateResponseHeader(StreamingStateTransfer.StateHeader hdr)
protected Tuple<java.io.InputStream,java.lang.Object> createStreamToProvider(Address provider, StreamingStateTransfer.StateHeader hdr) throws java.lang.Exception
StreamingStateTransfer
createStreamToProvider
在类中 StreamingStateTransfer
java.lang.Exception
protected void close(java.lang.Object resource)
close
在类中 StreamingStateTransfer
protected void handleStateReq(Address requester)
handleStateReq
在类中 StreamingStateTransfer
protected void handleViewChange(View v)
protected void handleConfig(java.util.Map<java.lang.String,java.lang.Object> config)
handleConfig
在类中 StreamingStateTransfer