public class STATE extends StreamingStateTransfer
BlockingInputStream
) from which the MessageListener.setState(java.io.InputStream)
reads it. The size of the BlockingInputStream is buffer_size bytes.
When implementing MessageListener.getState(java.io.OutputStream)
, the state should be written in sizeable
chunks, because the underlying output stream generates 1 message / write. 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.Modifier and Type | Class and Description |
---|---|
protected class |
STATE.StateOutputStream |
StreamingStateTransfer.StateGetter, StreamingStateTransfer.StateHeader
Modifier and Type | Field and Description |
---|---|
protected BlockingInputStream |
input_stream
If use_default_transport is true, we consume bytes off of this blocking queue.
|
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() |
Modifier and Type | Method and Description |
---|---|
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 |
createStreamToRequester(Address requester)
Creates an OutputStream to the state requester to write the state
|
protected void |
handleEOF(Address sender) |
protected void |
handleException(java.lang.Throwable exception) |
protected void |
handleStateChunk(Address sender,
byte[] buffer,
int offset,
int length) |
protected void |
handleViewChange(View v) |
protected boolean |
useAsyncStateDelivery() |
close, closeBarrierAndSuspendStable, closeHoleFor, createThreadPool, destroy, determineCoordinator, down, getAverageStateSize, getNumberOfStateBytesSent, getNumberOfStateRequests, getStateFromApplication, getThreadPoolCompletedTasks, getThreadPoolSize, handle, handleConfig, handleStateReq, handleStateRsp, init, isDigestNeeded, modifyStateResponseHeader, openBarrier, openBarrierAndResumeStable, punchHoleFor, requiredDownServices, resetStats, resumeStable, sendEof, sendException, setStateInApplication, start, stop, up
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 volatile BlockingInputStream input_stream
protected void handleViewChange(View v)
handleViewChange
in class StreamingStateTransfer
protected void handleEOF(Address sender)
handleEOF
in class StreamingStateTransfer
protected void handleException(java.lang.Throwable exception)
handleException
in class StreamingStateTransfer
protected void handleStateChunk(Address sender, byte[] buffer, int offset, int length)
handleStateChunk
in class StreamingStateTransfer
protected void createStreamToRequester(Address requester)
StreamingStateTransfer
createStreamToRequester
in class StreamingStateTransfer
protected Tuple<java.io.InputStream,java.lang.Object> createStreamToProvider(Address provider, StreamingStateTransfer.StateHeader hdr)
StreamingStateTransfer
createStreamToProvider
in class StreamingStateTransfer
protected boolean useAsyncStateDelivery()
useAsyncStateDelivery
in class StreamingStateTransfer
Copyright © 1998-2020 Red Hat. All Rights Reserved.