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
Modifier and Type | Class and Description |
---|---|
protected class |
STATE_SOCK.StateProviderAcceptor |
StreamingStateTransfer.StateGetter, StreamingStateTransfer.StateHeader
Modifier and Type | Field and Description |
---|---|
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
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
STATE_SOCK() |
Modifier and Type | Method and Description |
---|---|
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, afterCreationHook, 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 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
in class StreamingStateTransfer
protected STATE_SOCK.StateProviderAcceptor createAcceptor()
protected void modifyStateResponseHeader(StreamingStateTransfer.StateHeader hdr)
modifyStateResponseHeader
in class StreamingStateTransfer
protected Tuple<java.io.InputStream,java.lang.Object> createStreamToProvider(Address provider, StreamingStateTransfer.StateHeader hdr) throws java.lang.Exception
StreamingStateTransfer
createStreamToProvider
in class StreamingStateTransfer
java.lang.Exception
protected void close(java.lang.Object resource)
close
in class StreamingStateTransfer
protected void handleStateReq(Address requester)
handleStateReq
in class StreamingStateTransfer
protected void handleViewChange(View v)
handleViewChange
in class StreamingStateTransfer
protected void handleConfig(java.util.Map<java.lang.String,java.lang.Object> config)
handleConfig
in class StreamingStateTransfer
Copyright © 1998-2020 Red Hat. All Rights Reserved.