java - 使用 Apache Ignite 重新部署 JBoss WAR 时,无法编组自定义事件:StartRoutineDiscoveryMessage
问题描述
我正在努力做到这一点,以便我可以使用具有 apache ignite 的 WAR 重新部署 JBoss 7.1.0 集群。
我正在像这样启动缓存:
System.setProperty("IGNITE_UPDATE_NOTIFIER", "false");
igniteConfiguration = new IgniteConfiguration();
int failureDetectionTimeout = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_FAILURE_DETECTION_TIMEOUT", "60000"));
igniteConfiguration.setFailureDetectionTimeout(failureDetectionTimeout);
String igniteVmIps = getProperty("IGNITE_VM_IPS");
List<String> addresses = Arrays.asList("127.0.0.1:47500");
if (StringUtils.isNotBlank(igniteVmIps)) {
addresses = Arrays.asList(igniteVmIps.split(","));
}
int networkTimeout = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_NETWORK_TIMEOUT", "60000"));
boolean failureDetectionTimeoutEnabled = Boolean.parseBoolean(getProperty("IGNITE_TCP_DISCOVERY_FAILURE_DETECTION_TIMEOUT_ENABLED", "true"));
int tcpDiscoveryLocalPort = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_LOCAL_PORT", "47500"));
int tcpDiscoveryLocalPortRange = Integer.parseInt(getProperty("IGNITE_TCP_DISCOVERY_LOCAL_PORT_RANGE", "0"));
TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
tcpDiscoverySpi.setLocalPort(tcpDiscoveryLocalPort);
tcpDiscoverySpi.setLocalPortRange(tcpDiscoveryLocalPortRange);
tcpDiscoverySpi.setNetworkTimeout(networkTimeout);
tcpDiscoverySpi.failureDetectionTimeoutEnabled(failureDetectionTimeoutEnabled);
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(addresses);
tcpDiscoverySpi.setIpFinder(ipFinder);
igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);
Ignite ignite = Ignition.start(igniteConfiguration);
ignite.cluster().active(true);
然后,当应用程序取消部署时,我将停止缓存:
ignite.close();
当我尝试重新部署时,在初始化期间出现以下错误。
org.apache.ignite.spi.IgniteSpiException: Failed to marshal custom event: StartRoutineDiscoveryMessage [startReqData=StartRequestData [prjPred=org.apache.ignite.internal.cluster.ClusterGroupAdapter$CachesFilter@7385a997, clsName=null, depInfo=null, hnd=org.apache.ignite.internal.GridEventConsumeHandler@2aec6952, bufSize=1, interval=0, autoUnsubscribe=true], keepBinary=false, deserEx=null, routineId=bbe16e8e-2820-4ba0-a958-d5f644498ba2]
如果我完全重新启动服务器,则启动正常。
我在关机过程中错过了一些魔法吗?
解决方案
我知道我做错了什么,这是我从票证中遗漏的代码。
ignite.events(ignite.cluster().forCacheNodes(cacheConfig.getKey())).remoteListen(locLsnr, rmtLsnr,
EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_REMOVED);
当它尝试两次注册此代码时,它导致了那个奇怪的错误。
我现在在它周围放置了一个 try-catch 忽略,事情似乎还可以。
推荐阅读
- java - Spring Boot 应用程序正在将空值插入到我的 mysql 表中
- java - 如何在 Java(Dropwizard 框架)中进行异步 API 调用以更新 Couchbase 记录?
- flutter - 没有为“AudioPlayer”类定义吸气剂“onDurationChanged”
- c# - 我的网格因 IK 和动画而中断,unity3D
- python-3.x - 尽管 try/except 斐波那契数列停止内核
- android - backStack 到 jetpack compose 屏幕时再次调用 api
- javascript - React 查询错误边界:如何根据用户是否第二次看到该组件,为用户提供不同的选项
- c++ - 如何为动态数组或 uni_ptr 编写移动构造函数和移动赋值运算符?
- javascript - 为什么我的个人资料图像尽管发生了变化仍然是匿名的?
- reactjs - 如何在 react-router-dom v6 的路由组件中添加道具