当前位置: 首页>>代码示例>>Java>>正文


Java RpcChannel.MAJORITY_REPLY属性代码示例

本文整理汇总了Java中org.apache.catalina.tribes.group.RpcChannel.MAJORITY_REPLY属性的典型用法代码示例。如果您正苦于以下问题:Java RpcChannel.MAJORITY_REPLY属性的具体用法?Java RpcChannel.MAJORITY_REPLY怎么用?Java RpcChannel.MAJORITY_REPLY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.catalina.tribes.group.RpcChannel的用法示例。


在下文中一共展示了RpcChannel.MAJORITY_REPLY属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

public static void main(String[] args) throws Exception {
    long pause = 3000;
    int count = 1000000;
    int stats = 10000;
    String name = "EchoRpcId";
    int options = RpcChannel.ALL_REPLY;
    long timeout = 15000;
    String message = "EchoRpcMessage";
    if (args.length == 0) {
        usage();
        System.exit(1);
    }
    for (int i = 0; i < args.length; i++) {
        if ("-threads".equals(args[i])) {
            // Not used
        } 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])) {
            // Not used
        } else if ("-stats".equals(args[i])) {
            stats = Integer.parseInt(args[++i]);
            System.out.println("Stats every "+stats+" message");
        } else if ("-timeout".equals(args[i])) {
            timeout = Long.parseLong(args[++i]);
        } else if ("-message".equals(args[i])) {
            message = args[++i];
        } else if ("-name".equals(args[i])) {
            name = args[++i];
        } else if ("-mode".equals(args[i])) {
            if ( "all".equals(args[++i]) ) options = RpcChannel.ALL_REPLY;
            else if ( "first".equals(args[i]) ) options = RpcChannel.FIRST_REPLY;
            else if ( "majority".equals(args[i]) ) options = RpcChannel.MAJORITY_REPLY;
        } else if ("-debug".equals(args[i])) {
            // Not used
        } else if ("-help".equals(args[i])) {
            usage();
            System.exit(1);
        }
    }


    ManagedChannel channel = (ManagedChannel)ChannelCreator.createChannel(args);
    EchoRpcTest test = new EchoRpcTest(channel,name,count,message,pause,options,timeout);
    channel.start(Channel.DEFAULT);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    test.run();

    System.out.println("System test complete, sleeping to let threads finish.");
    Thread.sleep(60*1000*60);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:53,代码来源:EchoRpcTest.java

示例2: main

public static void main(String[] args) throws Exception {
    long pause = 3000;
    int count = 1000000;
    int stats = 10000;
    String name = "EchoRpcId";
    int options = RpcChannel.ALL_REPLY;
    long timeout = 15000;
    String message = "EchoRpcMessage";
    if (args.length == 0) {
        usage();
        System.exit(1);
    }
    for (int i = 0; i < args.length; i++) {
        if ("-threads".equals(args[i])) {
            // Not used
        } 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])) {
            // Not used
        } else if ("-stats".equals(args[i])) {
            stats = Integer.parseInt(args[++i]);
            System.out.println("Stats every "+stats+" message");
        } else if ("-timeout".equals(args[i])) {
            timeout = Long.parseLong(args[++i]);
        } else if ("-message".equals(args[i])) {
            message = args[++i];
        } else if ("-name".equals(args[i])) {
            name = args[++i];
        } else if ("-mode".equals(args[i])) {
            if ( "all".equals(args[++i]) ) options = RpcChannel.ALL_REPLY;
            else if ( "first".equals(args[i]) ) options = RpcChannel.FIRST_REPLY;
            else if ( "majority".equals(args[i]) ) options = RpcChannel.MAJORITY_REPLY;
        } else if ("-debug".equals(args[i])) {
            // Not used
        } else if ("-help".equals(args[i])) {
            usage();
            System.exit(1);
        }
    }
    
    
    ManagedChannel channel = (ManagedChannel)ChannelCreator.createChannel(args);
    EchoRpcTest test = new EchoRpcTest(channel,name,count,message,pause,options,timeout);
    channel.start(Channel.DEFAULT);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    test.run();
    
    System.out.println("System test complete, sleeping to let threads finish.");
    Thread.sleep(60*1000*60);
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:53,代码来源:EchoRpcTest.java


注:本文中的org.apache.catalina.tribes.group.RpcChannel.MAJORITY_REPLY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。