Class STATE

  • All Implemented Interfaces:
    ProcessingQueue.Handler<Address>

    public class STATE
    extends StreamingStateTransfer
    STATE streams the state (written to an OutputStream) to the state requester in chunks (defined by chunk_size). Every chunk is sent via a unicast message. The state requester writes the chunks into a blocking input stream (BlockingInputStream) from which the StateListener.setState(java.io.InputStream) reads it. The size of the BlockingInputStream is buffer_size bytes.

    When implementing StateListener.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 StateListener.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.

    Since:
    2.4
    Author:
    Bela Ban, Vladimir Blagojevic