org.apache.catalina.tribes.ManagedChannel Java Examples

The following examples show how to use org.apache.catalina.tribes.ManagedChannel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestUdpPackages.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #2
Source File: TestTcpFailureDetector.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    channel1.getMembershipService().setPayload("Channel-1".getBytes("ASCII"));
    channel2.getMembershipService().setPayload("Channel-2".getBytes("ASCII"));
    mbrlist1 = new TestMbrListener("Channel-1");
    mbrlist2 = new TestMbrListener("Channel-2");
    tcpFailureDetector1 = new TcpFailureDetector();
    tcpFailureDetector2 = new TcpFailureDetector();
    channel1.addInterceptor(tcpFailureDetector1);
    channel2.addInterceptor(tcpFailureDetector2);
    channel1.addMembershipListener(mbrlist1);
    channel2.addMembershipListener(mbrlist2);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
}
 
Example #3
Source File: TestMulticastPackages.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #4
Source File: MapDemo.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Main method
 * @param args
 * @throws Exception
 */
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    long start = System.currentTimeMillis();
    //create a channel object
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    //define a map name, unless one is defined as a paramters
    String mapName = "MapDemo";
    if ( args.length > 0 && (!args[args.length-1].startsWith("-"))) {
        mapName = args[args.length-1];
    }
    //start the channel
    channel.start(Channel.DEFAULT);
    //listen for shutdown
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    //create a map demo object
    new MapDemo(channel,mapName);

    //put the main thread to sleep until we are done
    System.out.println("System test complete, time to start="+(System.currentTimeMillis()-start)+" ms. Sleeping to let threads finish.");
    Thread.sleep(60 * 1000 * 60);
}
 
Example #5
Source File: MembersWithProperties.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    if (args.length==0) usage();
    main = Thread.currentThread();
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    Properties props = new Properties();
    props.setProperty("mydomainkey","mydomainvalue");
    props.setProperty("someotherkey", Arrays.toString(UUIDGenerator.randomUUID(true)));
    new MembersWithProperties(channel, props);
    channel.start(Channel.DEFAULT);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    try {
        Thread.sleep(Long.MAX_VALUE);
    }catch(InterruptedException ix) {
        Thread.sleep(5000);//allow everything to shutdown
    }
}
 
Example #6
Source File: MembersWithProperties.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    if (args.length==0) usage();
    main = Thread.currentThread();
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    Properties props = new Properties();
    props.setProperty("mydomainkey","mydomainvalue");
    props.setProperty("someotherkey", Arrays.toString(UUIDGenerator.randomUUID(true)));
    new MembersWithProperties(channel, props);
    channel.start(Channel.DEFAULT);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    try {
        Thread.sleep(Long.MAX_VALUE);
    }catch(InterruptedException ix) {
        Thread.sleep(5000);//allow everything to shutdown
    }
}
 
Example #7
Source File: TestUdpPackages.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #8
Source File: TestUdpPackages.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatchInterceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatchInterceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #9
Source File: TestMulticastPackages.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatchInterceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatchInterceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #10
Source File: TestTcpFailureDetector.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    channel1.getMembershipService().setPayload("Channel-1".getBytes("ASCII"));
    channel2.getMembershipService().setPayload("Channel-2".getBytes("ASCII"));
    mbrlist1 = new TestMbrListener("Channel-1");
    mbrlist2 = new TestMbrListener("Channel-2");
    tcpFailureDetector1 = new TcpFailureDetector();
    tcpFailureDetector2 = new TcpFailureDetector();
    channel1.addInterceptor(tcpFailureDetector1);
    channel2.addInterceptor(tcpFailureDetector2);
    channel1.addMembershipListener(mbrlist1);
    channel2.addMembershipListener(mbrlist2);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
}
 
Example #11
Source File: MapDemo.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    long start = System.currentTimeMillis();
    //create a channel object
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    //define a map name, unless one is defined as a parameters
    String mapName = "MapDemo";
    if ( args.length > 0 && (!args[args.length-1].startsWith("-"))) {
        mapName = args[args.length-1];
    }
    //start the channel
    channel.start(Channel.DEFAULT);
    //listen for shutdown
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    //create a map demo object
    new MapDemo(channel,mapName);

    //put the main thread to sleep until we are done
    System.out.println("System test complete, time to start="+(System.currentTimeMillis()-start)+" ms. Sleeping to let threads finish.");
    Thread.sleep(60 * 1000 * 60);
}
 
Example #12
Source File: TestTcpFailureDetector.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    channel1.getMembershipService().setPayload("Channel-1".getBytes("ASCII"));
    channel2.getMembershipService().setPayload("Channel-2".getBytes("ASCII"));
    mbrlist1 = new TestMbrListener("Channel-1");
    mbrlist2 = new TestMbrListener("Channel-2");
    tcpFailureDetector1 = new TcpFailureDetector();
    tcpFailureDetector2 = new TcpFailureDetector();
    channel1.addInterceptor(tcpFailureDetector1);
    channel2.addInterceptor(tcpFailureDetector2);
    channel1.addMembershipListener(mbrlist1);
    channel2.addMembershipListener(mbrlist2);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
}
 
Example #13
Source File: MembersWithProperties.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    if (args.length==0) usage();
    main = Thread.currentThread();
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    Properties props = new Properties();
    props.setProperty("mydomainkey","mydomainvalue");
    props.setProperty("someotherkey", Arrays.toString(UUIDGenerator.randomUUID(true)));
    new MembersWithProperties(channel, props);
    channel.start(Channel.DEFAULT);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    try {
        Thread.sleep(Long.MAX_VALUE);
    }catch(InterruptedException ix) {
        Thread.sleep(5000);//allow everything to shutdown
    }
}
 
Example #14
Source File: MapDemo.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Main method
 * @param args
 * @throws Exception
 */
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    long start = System.currentTimeMillis();
    //create a channel object
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    //define a map name, unless one is defined as a paramters
    String mapName = "MapDemo";
    if ( args.length > 0 && (!args[args.length-1].startsWith("-"))) {
        mapName = args[args.length-1];
    }
    //start the channel
    channel.start(Channel.DEFAULT);
    //listen for shutdown
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    //create a map demo object
    new MapDemo(channel,mapName);

    //put the main thread to sleep until we are done
    System.out.println("System test complete, time to start="+(System.currentTimeMillis()-start)+" ms. Sleeping to let threads finish.");
    Thread.sleep(60 * 1000 * 60);
}
 
Example #15
Source File: TestMulticastPackages.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #16
Source File: LoadTest.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public LoadTest(ManagedChannel channel,
                boolean send,
                int msgCount,
                boolean debug,
                long pause,
                int stats,
                boolean breakOnEx) {
    this.channel = channel;
    this.send = send;
    this.msgCount = msgCount;
    this.debug = debug;
    this.pause = pause;
    this.statsInterval = stats;
    this.breakonChannelException = breakOnEx;
}
 
Example #17
Source File: TestRemoteProcessException.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #18
Source File: TestDataIntegrity.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #19
Source File: ChannelSF.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Store the specified Channel children.
 *
 * @param aWriter
 *            PrintWriter to which we are storing
 * @param indent
 *            Number of spaces to indent this element
 * @param aChannel
 *            Channel whose properties are being stored
 *
 * @exception Exception
 *                if an exception occurs while storing
 */
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aChannel,
        StoreDescription parentDesc) throws Exception {
    if (aChannel instanceof Channel) {
        Channel channel = (Channel) aChannel;
        if (channel instanceof ManagedChannel) {
            ManagedChannel managedChannel = (ManagedChannel) channel;
            // Store nested <Membership> element
            MembershipService service = managedChannel.getMembershipService();
            if (service != null) {
                storeElement(aWriter, indent, service);
            }
            // Store nested <Sender> element
            ChannelSender sender = managedChannel.getChannelSender();
            if (sender != null) {
                storeElement(aWriter, indent, sender);
            }
            // Store nested <Receiver> element
            ChannelReceiver receiver = managedChannel.getChannelReceiver();
            if (receiver != null) {
                storeElement(aWriter, indent, receiver);
            }
            Iterator<ChannelInterceptor> interceptors = managedChannel.getInterceptors();
            while (interceptors.hasNext()) {
                ChannelInterceptor interceptor = interceptors.next();
                storeElement(aWriter, indent, interceptor);
            }
        }
   }
}
 
Example #20
Source File: LoadTest.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public LoadTest(ManagedChannel channel,
                boolean send,
                int msgCount,
                boolean debug,
                long pause,
                int stats,
                boolean breakOnEx) {
    this.channel = channel;
    this.send = send;
    this.msgCount = msgCount;
    this.debug = debug;
    this.pause = pause;
    this.statsInterval = stats;
    this.breakonChannelException = breakOnEx;
}
 
Example #21
Source File: TestDataIntegrity.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #22
Source File: TestRemoteProcessException.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #23
Source File: LoadTest.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public LoadTest(ManagedChannel channel,
                boolean send,
                int msgCount,
                boolean debug,
                long pause,
                int stats,
                boolean breakOnEx) {
    this.channel = channel;
    this.send = send;
    this.msgCount = msgCount;
    this.debug = debug;
    this.pause = pause;
    this.statsInterval = stats;
    this.breakonChannelException = breakOnEx;
}
 
Example #24
Source File: TestRemoteProcessException.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #25
Source File: TestDataIntegrity.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatchInterceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatchInterceptor());
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example #26
Source File: LoadTest.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
public Shutdown(ManagedChannel channel) {
    this.channel = channel;
}
 
Example #27
Source File: EchoRpcTest.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public Shutdown(ManagedChannel channel) {
    this.channel = channel;
}
 
Example #28
Source File: MembersWithProperties.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public MembersWithProperties(Channel channel, Properties props) throws IOException {
    channel.addMembershipListener(this);
    ManagedChannel mchannel = (ManagedChannel)channel;
    mchannel.getMembershipService().setPayload(getPayload(props));
}
 
Example #29
Source File: MembersWithProperties.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public Shutdown(ManagedChannel channel) {
    this.channel = channel;
}
 
Example #30
Source File: LoadTest.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    boolean send = true;
    boolean debug = false;
    long pause = 0;
    int count = 1000000;
    int stats = 10000;
    boolean breakOnEx = false;
    int threads = 1;
    boolean shutdown = false;
    int startoptions = Channel.DEFAULT;
    int channelOptions = Channel.SEND_OPTIONS_DEFAULT;
    if ( args.length == 0 ) {
        args = new String[] {"-help"};
    }
    for (int i = 0; i < args.length; i++) {
        if ("-threads".equals(args[i])) {
            threads = Integer.parseInt(args[++i]);
        } else if ("-count".equals(args[i])) {
            count = Integer.parseInt(args[++i]);
            System.out.println("Sending "+count+" messages.");
        } else if ("-pause".equals(args[i])) {
            pause = Long.parseLong(args[++i])*1000;
        } else if ("-break".equals(args[i])) {
            breakOnEx = true;
        } else if ("-shutdown".equals(args[i])) {
            shutdown = true;
        } else if ("-stats".equals(args[i])) {
            stats = Integer.parseInt(args[++i]);
            System.out.println("Stats every "+stats+" message");
        } else if ("-sendoptions".equals(args[i])) {
            channelOptions = Integer.parseInt(args[++i]);
            System.out.println("Setting send options to "+channelOptions);
        } else if ("-startoptions".equals(args[i])) {
            startoptions = Integer.parseInt(args[++i]);
            System.out.println("Setting start options to "+startoptions);
        } else if ("-size".equals(args[i])) {
            size = Integer.parseInt(args[++i])-4;
            System.out.println("Message size will be:"+(size+4)+" bytes");
        } else if ("-mode".equals(args[i])) {
            if ( "receive".equals(args[++i]) ) send = false;
        } else if ("-debug".equals(args[i])) {
            debug = true;
        } else if ("-help".equals(args[i]))
        {
            usage();
            System.exit(1);
        }
    }

    ManagedChannel channel = (ManagedChannel)ChannelCreator.createChannel(args);

    LoadTest test = new LoadTest(channel,send,count,debug,pause,stats,breakOnEx);
    test.channelOptions = channelOptions;
    LoadMessage msg = new LoadMessage();

    messageSize = LoadMessage.getMessageSize(msg);
    channel.addChannelListener(test);
    channel.addMembershipListener(test);
    channel.start(startoptions);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    while ( threads > 1 ) {
        Thread t = new Thread(test);
        t.setDaemon(true);
        t.start();
        threads--;
        test = new LoadTest(channel,send,count,debug,pause,stats,breakOnEx);
        test.channelOptions = channelOptions;
    }
    test.run();
    if ( shutdown && send ) channel.stop(Channel.DEFAULT);
    System.out.println("System test complete, sleeping to let threads finish.");
    Thread.sleep(60*1000*60);
}