Package org.jgroups.tests
Class LargeState
- java.lang.Object
-
- org.jgroups.tests.LargeState
-
- All Implemented Interfaces:
Receiver
public class LargeState extends java.lang.Object implements 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.: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
Fields Modifier and Type Field Description (package private) JChannelchannel(package private) longdelay(package private) java.lang.Stringprops(package private) booleanprovider(package private) booleanprovider_fails(package private) booleanrc(package private) booleanrequester_fails(package private) intsize(package private) longstart(package private) byte[]state(package private) longstop(package private) inttotal_received
-
Constructor Summary
Constructors Constructor Description LargeState()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static byte[]createLargeState(int size)voidgetState(java.io.OutputStream ostream)Allows an application to write the state to an OutputStream.(package private) static voidhelp()static voidmain(java.lang.String[] args)voidreceive(Message msg)Called when a message is received.voidsetState(java.io.InputStream istream)Allows an application to read the state from an InputStream.voidstart(boolean provider, int size, java.lang.String props, boolean provider_fails, boolean requester_fails, long delay, java.lang.String name)voidviewAccepted(View new_view)Called when a change in membership has occurred.
-
-
-
Field Detail
-
channel
JChannel channel
-
state
byte[] state
-
rc
boolean rc
-
props
java.lang.String props
-
start
long start
-
stop
long stop
-
provider
boolean provider
-
provider_fails
boolean provider_fails
-
requester_fails
boolean requester_fails
-
size
int size
-
total_received
int total_received
-
delay
long delay
-
-
Method Detail
-
start
public void start(boolean provider, int size, java.lang.String props, boolean provider_fails, boolean requester_fails, long delay, java.lang.String name) throws java.lang.Exception- Throws:
java.lang.Exception
-
createLargeState
static byte[] createLargeState(int size)
-
receive
public void receive(Message msg)
Description copied from interface:ReceiverCalled when a message is received.
-
viewAccepted
public void viewAccepted(View new_view)
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 whenJChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
setState
public void setState(java.io.InputStream istream) throws java.lang.ExceptionDescription 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
public void getState(java.io.OutputStream ostream) throws java.lang.ExceptionDescription 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
public static void main(java.lang.String[] args)
-
help
static void help()
-
-