Java Code Examples for org.apache.catalina.tribes.Channel#SEND_OPTIONS_DEFAULT

The following examples show how to use org.apache.catalina.tribes.Channel#SEND_OPTIONS_DEFAULT . 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: LoadTest.java    From Tomcat7.0.67 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);
}
 
Example 2
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);
}
 
Example 3
Source File: LoadTest.java    From Tomcat8-Source-Read with MIT License 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);
}
 
Example 4
Source File: LazyReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls) {
    super(owner, channel,timeout,mapContextName,initialCapacity, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 5
Source File: LazyReplicatedMap.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls) {
    super(owner, channel,timeout,mapContextName,initialCapacity, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 6
Source File: LazyReplicatedMap.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls) {
    super(owner, channel,timeout,mapContextName, AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY,AbstractReplicatedMap.DEFAULT_LOAD_FACTOR,Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 7
Source File: ReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls) {
    super(owner, channel, timeout, mapContextName,AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 8
Source File: ReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls) {
    super(owner,channel, timeout, mapContextName, initialCapacity, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR,Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 9
Source File: ReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 * @param loadFactor float - load factor, see HashMap
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity,float loadFactor, ClassLoader[] cls) {
    super(owner,channel, timeout, mapContextName, initialCapacity, loadFactor, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 10
Source File: LazyReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param terminate boolean - Flag for whether to terminate this map that failed to start.
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls, boolean terminate) {
    super(owner, channel,timeout,mapContextName, AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY,
            AbstractReplicatedMap.DEFAULT_LOAD_FACTOR,Channel.SEND_OPTIONS_DEFAULT, cls, terminate);
}
 
Example 11
Source File: LazyReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls) {
    super(owner, channel,timeout,mapContextName, AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY,AbstractReplicatedMap.DEFAULT_LOAD_FACTOR,Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 12
Source File: ReplicatedMap.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param terminate boolean - Flag for whether to terminate this map that failed to start.
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls, boolean terminate) {
    super(owner, channel, timeout, mapContextName,AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY,
            AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, terminate);
}
 
Example 13
Source File: LazyReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 * @param loadFactor float - load factor, see HashMap
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, float loadFactor, ClassLoader[] cls) {
    super(owner,channel,timeout,mapContextName,initialCapacity,loadFactor, Channel.SEND_OPTIONS_DEFAULT,cls, true);
}
 
Example 14
Source File: ReplicatedMap.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Creates a new map
 * @param owner The map owner
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messages
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param cls Class loaders
 * @param terminate boolean - Flag for whether to terminate this map that failed to start.
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls, boolean terminate) {
    super(owner, channel, timeout, mapContextName,AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY,
            AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, terminate);
}
 
Example 15
Source File: ReplicatedMap.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Creates a new map
 * @param owner The map owner
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messages
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param cls Class loaders
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls) {
    super(owner, channel, timeout, mapContextName,AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 16
Source File: ReplicatedMap.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Creates a new map
 * @param owner The map owner
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messages
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 * @param cls Class loaders
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls) {
    super(owner,channel, timeout, mapContextName, initialCapacity, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR,Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 17
Source File: ReplicatedMap.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Creates a new map
 * @param owner The map owner
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messages
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 * @param loadFactor float - load factor, see HashMap
 * @param cls Class loaders
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity,float loadFactor, ClassLoader[] cls) {
    super(owner,channel, timeout, mapContextName, initialCapacity, loadFactor, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 18
Source File: ReplicatedMap.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 * @param loadFactor float - load factor, see HashMap
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity,float loadFactor, ClassLoader[] cls) {
    super(owner,channel, timeout, mapContextName, initialCapacity, loadFactor, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 19
Source File: ReplicatedMap.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new map
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messags
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 */
public ReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, ClassLoader[] cls) {
    super(owner, channel, timeout, mapContextName,AbstractReplicatedMap.DEFAULT_INITIAL_CAPACITY, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}
 
Example 20
Source File: LazyReplicatedMap.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Creates a new map
 * @param owner The map owner
 * @param channel The channel to use for communication
 * @param timeout long - timeout for RPC messages
 * @param mapContextName String - unique name for this map, to allow multiple maps per channel
 * @param initialCapacity int - the size of this map, see HashMap
 * @param cls Class loaders
 */
public LazyReplicatedMap(MapOwner owner, Channel channel, long timeout, String mapContextName, int initialCapacity, ClassLoader[] cls) {
    super(owner, channel,timeout,mapContextName,initialCapacity, AbstractReplicatedMap.DEFAULT_LOAD_FACTOR, Channel.SEND_OPTIONS_DEFAULT, cls, true);
}