We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
com.xiaoju.automarket.elasticjobstarter.dynamic.service.JobService#monitorJobRegister 方法的实现里面有一行获取监听到节点的配置。 String config = new String((byte[])client.getData().forPath(data.getPath() + "/config")); 这一行直接去读取config节点。 看了下jobx的源码里面新任务注册的逻辑。
com.xiaoju.automarket.elastic.job.lite.internal.config.ConfigurationService#persist com.xiaoju.automarket.elastic.job.lite.internal.storage.JobNodeStorage#replaceJobNode com.xiaoju.automarket.elastic.job.reg.base.RegistryCenter#persist client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(key, value.getBytes(Charsets.UTF_8));
创建/xxx/MyJob/config节点之前,会先创建/xxx/MyJob节点。 在极端情况下,/xxx/MyJob创建之后,/xxx/MyJob/config节点创建之前,监听逻辑读取config节点报错。 org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /xxx/MyJob/config
curator里面的创建任务节点相关代码见 org.apache.curator.framework.imps.CreateBuilderImpl#pathInForeground 会根据org.apache.curator.framework.imps.CreateBuilderImpl#createParentsIfNeeded判断是否创建父节点,如果该值为true,会先创建父节点,再创建子节点。
The text was updated successfully, but these errors were encountered:
@yinjihuan 大佬有时间帮忙看下
Sorry, something went wrong.
我实现的方式是, 在addJob逻辑结束后, 更新一下zk节点的数据, 监听程序新增一个监听数据更新的逻辑, 与新增逻辑基本相同. 就可以保证这种极端情况下, 也能把一台服务器新增的定时任务, 同步到另一台服务器
No branches or pull requests
com.xiaoju.automarket.elasticjobstarter.dynamic.service.JobService#monitorJobRegister
方法的实现里面有一行获取监听到节点的配置。
String config = new String((byte[])client.getData().forPath(data.getPath() + "/config"));
这一行直接去读取config节点。
看了下jobx的源码里面新任务注册的逻辑。
com.xiaoju.automarket.elastic.job.lite.internal.config.ConfigurationService#persist
com.xiaoju.automarket.elastic.job.lite.internal.storage.JobNodeStorage#replaceJobNode
com.xiaoju.automarket.elastic.job.reg.base.RegistryCenter#persist
client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(key, value.getBytes(Charsets.UTF_8));
创建/xxx/MyJob/config节点之前,会先创建/xxx/MyJob节点。
在极端情况下,/xxx/MyJob创建之后,/xxx/MyJob/config节点创建之前,监听逻辑读取config节点报错。
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /xxx/MyJob/config
curator里面的创建任务节点相关代码见
org.apache.curator.framework.imps.CreateBuilderImpl#pathInForeground
会根据org.apache.curator.framework.imps.CreateBuilderImpl#createParentsIfNeeded判断是否创建父节点,如果该值为true,会先创建父节点,再创建子节点。
The text was updated successfully, but these errors were encountered: