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 InetAddress |
bind_addr |
protected String |
bind_interface_str |
protected int |
bind_port |
protected 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, barrier_closed, buffer_size, flushProtocolInStack, local_addr, max_pool, members, num_bytes_sent, num_state_reqs, pending_state_transfers, pool_thread_keep_alive, state_lock, state_provider, thread_pool| Constructor and Description |
|---|
STATE_SOCK() |
| Modifier and Type | Method and Description |
|---|---|
protected STATE_SOCK.StateProviderAcceptor |
createAcceptor() |
protected void |
createStreamToProvider(Address provider,
StreamingStateTransfer.StateHeader hdr)
Creates an InputStream to the state provider to read the state
|
protected void |
createStreamToRequester(Address requester)
Creates an OutputStream to the state requester to write the state
|
protected void |
handleConfig(Map<String,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, createThreadPool, destroy, determineCoordinator, down, getAverageStateSize, getNumberOfStateBytesSent, getNumberOfStateRequests, getStateFromApplication, getThreadPoolCompletedTasks, getThreadPoolSize, handleEOF, handleException, handleStateChunk, init, isDigestNeeded, openBarrierAndResumeStable, removeRequester, requiredDownServices, resetStats, sendEof, sendException, setStateInApplication, start, updumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabledprotected InetAddress bind_addr
protected InetAddress external_addr
protected int external_port
protected String bind_interface_str
protected int bind_port
protected volatile STATE_SOCK.StateProviderAcceptor spawner
public void stop()
ProtocolChannel.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 StreamingStateTransferprotected STATE_SOCK.StateProviderAcceptor createAcceptor()
protected void modifyStateResponseHeader(StreamingStateTransfer.StateHeader hdr)
modifyStateResponseHeader in class StreamingStateTransferprotected void createStreamToRequester(Address requester)
StreamingStateTransfercreateStreamToRequester in class StreamingStateTransferprotected void createStreamToProvider(Address provider, StreamingStateTransfer.StateHeader hdr)
StreamingStateTransfercreateStreamToProvider in class StreamingStateTransferprotected void handleStateReq(Address requester)
handleStateReq in class StreamingStateTransferprotected void handleViewChange(View v)
handleViewChange in class StreamingStateTransferprotected void handleConfig(Map<String,Object> config)
handleConfig in class StreamingStateTransferCopyright © 2012 JBoss by Red Hat. All Rights Reserved.