KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > tests > bla


1 package org.jgroups.tests;
2
3 import org.jgroups.*;
4 import org.jgroups.util.Util;
5 import org.jgroups.blocks.ReplicatedHashMap;
6
7 import java.util.Map JavaDoc;
8 import java.util.Vector JavaDoc;
9 import java.net.ServerSocket JavaDoc;
10 import java.net.Socket JavaDoc;
11
12
13 public class bla {
14
15
16
17
18     public static void main(String JavaDoc[] args) throws Exception JavaDoc {
19         JChannelFactory f=new JChannelFactory();
20         f.setMultiplexerConfig("stacks.xml");
21
22         Channel ch=f.createMultiplexerChannel("udp", "one");
23         ch.setReceiver(new ExtendedReceiverAdapter() {
24             public void viewAccepted(View new_view) {
25                 System.out.println("view: " + new_view);
26             }
27         });
28
29         ch.connect("x");
30
31         Util.sleep(2000);
32
33         JChannelFactory f2=new JChannelFactory();
34         f2.setMultiplexerConfig("stacks.xml");
35         Channel ch2=f2.createMultiplexerChannel("udp", "one");
36         ch2.connect("x");
37         Util.sleep(2000);
38
39         ch.disconnect();
40         ch.close();
41
42         ch2.close();
43     }
44
45
46
47 }
Popular Tags