01: package org.jgroups.demos;
02:
03: import org.jgroups.Channel;
04: import org.jgroups.JChannelFactory;
05:
06: /**
07: * @author Bela Ban
08: * @version $Id: DrawMultiplexer.java,v 1.6 2006/10/30 12:29:11 belaban Exp $
09: */
10: public class DrawMultiplexer {
11: JChannelFactory factory;
12:
13: public static void main(String[] args) throws Exception {
14: String props = "stacks.xml";
15: String stack_name = "udp";
16: for (int i = 0; i < args.length; i++) {
17: String arg = args[i];
18: if (arg.equals("-props")) {
19: props = args[++i];
20: continue;
21: }
22: if (arg.equals("-stack_name")) {
23: stack_name = args[++i];
24: continue;
25: }
26: System.out
27: .println("DrawMultiplexer [-help] [-props <stack config file>] [-stack_name <name>]");
28: return;
29: }
30: new DrawMultiplexer().start(props, stack_name);
31: }
32:
33: private void start(String props, String stack_name)
34: throws Exception {
35: factory = new JChannelFactory();
36: factory.setMultiplexerConfig(props);
37:
38: final Channel ch1, ch2;
39: ch1 = factory.createMultiplexerChannel(stack_name, "id-1");
40: Draw draw1 = new Draw(ch1);
41: ch1.connect("bela");
42:
43: ch2 = factory.createMultiplexerChannel(stack_name, "id-2");
44: Draw draw2 = new Draw(ch2);
45: ch2.connect("ban");
46:
47: draw1.go();
48: draw2.go();
49: }
50: }
|