本文整理汇总了Java中org.jgroups.fork.ForkChannel类的典型用法代码示例。如果您正苦于以下问题:Java ForkChannel类的具体用法?Java ForkChannel怎么用?Java ForkChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ForkChannel类属于org.jgroups.fork包,在下文中一共展示了ForkChannel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getJGroupsChannel
import org.jgroups.fork.ForkChannel; //导入依赖的package包/类
@Override
public Channel getJGroupsChannel(Properties p) {
try {
if (ApplicationProperty.OnlineSchedulingClusterForkChannel.isTrue()) {
return new ForkChannel(super.getJGroupsChannel(p), "forked-stack", "sectioning-channel",
true, ProtocolStack.ABOVE, FRAG2.class,
new RSVP().setValue("timeout", 60000).setValue("resend_interval", 500).setValue("ack_on_delivery", false));
} else {
return new JChannel(JGroupsUtils.getConfigurator(ApplicationProperty.OnlineSchedulingClusterConfiguration.value()));
}
} catch (Exception e) {
Debug.error(e.getMessage(), e);
return null;
}
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:16,代码来源:SectioningChannelLookup.java
示例2: joinCluster
import org.jgroups.fork.ForkChannel; //导入依赖的package包/类
@Synchronized
@Override
public void joinCluster() {
if (isConnected()) {
log.info("Already joined the cluster {}.", settings.getClusterName());
return;
}
try {
log.debug("Joining cluster {}...", settings.getClusterName());
this.channel = new JChannel(settings.getJgroupsConfigFile());
channel.setName(settings.getHostname());
channel.connect(settings.getClusterName());
ForkChannel taskChannel = new ForkChannel(channel, "tasks", "tasks_ch");
taskChannel.connect(settings.getClusterName());
taskState.initialize(taskChannel, channel.getAddressAsString());
ForkChannel rpcChannel = new ForkChannel(channel, "rpc", "rpc_ch");
rpcChannel.connect(settings.getClusterName());
messageDispatcher.initialize(rpcChannel, channel.getAddressAsString());
if (executor != null) executor.shutdown();
executor = Executors.newSingleThreadScheduledExecutor();
executor.scheduleAtFixedRate(taskState::removeOrphanTasks, 1, 1, TimeUnit.MINUTES);
log.info("Joined cluster {} with {} member(s).",
channel.getClusterName(), channel.getView().getMembers().size());
log.info("Cluster address: {}", channel.getAddress());
} catch (Exception e) {
channel = null;
log.catching(XLogger.Level.WARN, e);
log.info("Could not create or join cluster. Will work as single node.");
}
}
开发者ID:ccremer,项目名称:clustercode,代码行数:35,代码来源:JgroupsClusterImpl.java
注:本文中的org.jgroups.fork.ForkChannel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论