ITPub博客

首页 > 数据库 > > java jgroup_以编程方式开发集群中Infinispan的Jgroup通道

java jgroup_以编程方式开发集群中Infinispan的Jgroup通道

作者:LCR_ 时间:2022-04-14 17:33:35 0 删除 编辑

我正在集群设置中使用infinispan 8.1.0 Final和Wildfly 10 .

每台服务器都开始运行

C:\wildfly-10\bin\standalone.bat --server-config=standalone-ha.xml -b 10.09.139.215 -u 230.0.0.4 -Djboss.node.name=MyNode

我想在分布式模式下使用Infinispan以获得分布式缓存 . 但是对于强制性要求,我需要构建一个JGroups通道,以便从文件中动态读取一些属性 .

我需要此通道来构建基于TYPE和NAME的群集组(例如Type1-MyCluster) . 每个想要加入群集的服务器都必须使用相关通道 .

在网上航行我发现了一些类似下面的代码:

public class JGroupsChannelServiceActivator implements ServiceActivator {undefined

@Override

public void activate(ServiceActivatorContext context) {undefined

stackName = "udp";

try {undefined

channelServiceName = ChannelService.getServiceName(CHANNEL_NAME);

createChannel(context.getServiceTarget());

} catch (IllegalStateException e) {undefined

log.log(Level.INFO, "channel seems to already exist, skipping creation and binding.");

}

}

void createChannel(ServiceTarget target) {undefined

InjectedValue channelFactory = new InjectedValue<>();

ServiceName serviceName = ChannelFactoryService.getServiceName(stackName);

ChannelService channelService = new ChannelService(CHANNEL_NAME, channelFactory);

target.addService(channelServiceName, channelService)

.addDependency(serviceName, ChannelFactory.class, channelFactory).install();

}

我创建了META-INF / services / .... JGroupsChannelServiceActivator文件 .

当我将war部署到服务器时,操作失败并显示以下错误:

"{\"WFLYCTL0180: Services with missing/unavailable dependencies\" => [\"jboss.jgroups.channel.clusterWatchdog is missing [jboss.jgroups.stack.udp]\"]}"

我究竟做错了什么?如何以我需要的方式构建 Channels ?我以什么方式告诉infinispan使用该通道进行分布式缓存?

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70000523/viewspace-3160782/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2022-02-22

  • 博文量
    1402
  • 访问量
    14972