本文整理汇总了Java中org.apache.catalina.tribes.ManagedChannel.start方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedChannel.start方法的具体用法?Java ManagedChannel.start怎么用?Java ManagedChannel.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.tribes.ManagedChannel
的用法示例。
在下文中一共展示了ManagedChannel.start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
@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
}
}
示例2: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
/**
* 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);
}
示例3: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
/**
* 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);
}
示例4: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
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);
}
示例5: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
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);
}
示例6: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
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);
}
示例7: main
import org.apache.catalina.tribes.ManagedChannel; //导入方法依赖的package包/类
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);
}