Class STATE_SOCK

  • All Implemented Interfaces:
    Lifecycle, ProcessingQueue.Handler<Address>

    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 Receiver.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 Receiver.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:
    3.0
    Author:
    Vladimir Blagojevic, Bela Ban
    See Also:
    STATE_TRANSFER