KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > tests > adapttcp > TcpTester


1 package org.jgroups.tests.adapttcp;
2
3 import java.net.ServerSocket JavaDoc;
4 import java.util.List JavaDoc;
5
6
7
8 /** Javagroups version used was 2.0.3. Recompiled and tested again with 2.0.6.
9  * JGroupsTester:
10  * 1. Instantiates a JChannel object and joins the group.
11  * Partition properties conf. is the same as in the JBoss
12  * default configuration except for min_wait_time parameter
13  * that causes the following error:
14  * UNICAST.setProperties():
15  * these properties are not recognized:
16  * -- listing properties --
17  * min_wait_time=2000
18  * 2. Starts receiving until it receives a view change message
19  * with the expected number of members.
20  * 3. Starts the receiver thread and if(sender), the sender thread.
21  * @author Milcan Prica (prica@deei.units.it)
22  * @author Bela Ban (belaban@yahoo.com)
23  */

24 public class TcpTester {
25     private boolean sender;
26     private int num_msgs;
27     private int msg_size;
28     private int num_senders;
29     private long log_interval=1000;
30     ServerSocket JavaDoc srv_sock;
31     List JavaDoc nodes;
32
33
34     public TcpTester(boolean snd, int num_msgs,
35                             int msg_size, int gm, int ns, long log_interval,
36                             ServerSocket JavaDoc srv_sock, List JavaDoc nodes) {
37         sender=snd;
38         this.num_msgs=num_msgs;
39         this.msg_size=msg_size;
40         num_senders=ns;
41         this.log_interval=log_interval;
42         this.srv_sock=srv_sock;
43         this.nodes=nodes;
44     }
45
46     public void initialize() {
47         new ReceiverThread(srv_sock, num_msgs, msg_size, num_senders, log_interval).start();
48         if(sender) {
49             new SenderThread(nodes, num_msgs, msg_size, log_interval).start();
50         }
51     }
52 }
53
Popular Tags