Package org.jgroups.tests
Class LargeState
java.lang.Object
org.jgroups.tests.LargeState
- All Implemented Interfaces:
Receiver
Tests transfer of large states. Start first instance with -provider flag and -size flag (default = 1MB).
The start second instance without these flags: it should acquire the state from the first instance. Possibly
tracing should be turned on for FRAG to see the fragmentation taking place, e.g.:
Note that because fragmentation might generate a lot of small fragments at basically the same time (e.g. size1MB, FRAG.frag-size=4096 generates a lot of fragments), the send buffer of the unicast socket in UDP might be overloaded, causing it to drop some packets (default size is 8096 bytes). Therefore the send (and receive) buffers for the unicast socket have been increased (see ucast_send_buf_size and ucast_recv_buf_size below).
trace1=FRAG DEBUG STDOUT
Note that because fragmentation might generate a lot of small fragments at basically the same time (e.g. size1MB, FRAG.frag-size=4096 generates a lot of fragments), the send buffer of the unicast socket in UDP might be overloaded, causing it to drop some packets (default size is 8096 bytes). Therefore the send (and receive) buffers for the unicast socket have been increased (see ucast_send_buf_size and ucast_recv_buf_size below).
If we didn't do this, we would have some retransmission, slowing the state transfer down.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) JChannel(package private) long(package private) String(package private) boolean(package private) boolean(package private) boolean(package private) boolean(package private) int(package private) long(package private) byte[](package private) long(package private) int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static byte[]createLargeState(int size) voidgetState(OutputStream ostream) Allows an application to write the state to an OutputStream.(package private) static voidhelp()static voidvoidCalled when a message is received.voidsetState(InputStream istream) Allows an application to read the state from an InputStream.voidstart(boolean provider, int size, String props, boolean provider_fails, boolean requester_fails, long delay, String name) voidviewAccepted(View new_view) Called when a change in membership has occurred.
-
Field Details
-
Constructor Details
-
LargeState
public LargeState()
-
-
Method Details
-
start
public void start(boolean provider, int size, String props, boolean provider_fails, boolean requester_fails, long delay, String name) throws Exception - Throws:
Exception
-
createLargeState
static byte[] createLargeState(int size) -
receive
Description copied from interface:ReceiverCalled when a message is received. -
viewAccepted
Description copied from interface:ReceiverCalled when a change in membership has occurred. No long running actions, sending of messages or anything that could block should be done in this callback. If some long running action needs to be performed, it should be done in a separate thread.Note that on reception of the first view (a new member just joined), the channel will not yet be in the connected state. This only happens when
JChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
setState
Description copied from interface:ReceiverAllows an application to read the state from an InputStream. After the state has been read, the InputStream doesn't need to be closed as stream closing is automatically done when a calling thread returns from this callback. -
getState
Description copied from interface:ReceiverAllows an application to write the state to an OutputStream. After the state has been written, the OutputStream doesn't need to be closed as stream closing is automatically done when a calling thread returns from this callback. -
main
-
help
static void help()
-