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, 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() |
Modifier and Type | Method and Description |
---|---|
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 |
handleEOF(Address sender) |
protected void |
handleException(Throwable exception) |
protected void |
handleStateChunk(Address sender,
byte[] buffer,
int offset,
int length) |
protected void |
handleViewChange(View v) |
closeBarrierAndSuspendStable, createThreadPool, destroy, determineCoordinator, down, getAverageStateSize, getNumberOfStateBytesSent, getNumberOfStateRequests, getStateFromApplication, getThreadPoolCompletedTasks, getThreadPoolSize, handleConfig, handleStateReq, init, isDigestNeeded, modifyStateResponseHeader, openBarrierAndResumeStable, removeRequester, requiredDownServices, resetStats, sendEof, sendException, setStateInApplication, start, stop, up
dumpStats, 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, statsEnabled
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(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 void createStreamToProvider(Address provider, StreamingStateTransfer.StateHeader hdr)
StreamingStateTransfer
createStreamToProvider
in class StreamingStateTransfer
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.