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
问题描述见标题,我大概找到了问题原因: 主要是因为 JobScheduleController 在 shutdown 的时候没有同时释放 regCenter treeCache 缓存中的listenner,每次init() job 都会重复 addListener。( 这个问题应该不只是trigger有, 比如JobPausedStatusJobListenner 都可能会被重复add ),我现在的解决办法是在调用 JobScheduler init的之前先执行下面这段代码,这样可以避免这个问题:
val cachePath = "/" + job.getJobName(); val cache = (TreeCache) regCenter.getRawCache(cachePath); if (cache != null) { log.info("任务【" + job.getJobName() + "】clear regCenter cache " + cachePath); cache.close(); regCenter.remove(cachePath); }
我不是特别肯定这是程序bug,或者有其它的考虑,请亮哥判断下。 根本的问题是 Quartz 的 原生 schedule 里面的 trigger 对象被添加了好多次,如果重启服务器则不会有这个问题。 问题分析中源码的关键位置:
JobNodeStorage.java /** * 注册数据监听器. * * @param listener 数据监听器 */ public void addDataListener(final TreeCacheListener listener) { TreeCache cache = (TreeCache) regCenter.getRawCache("/" + jobName); cache.getListenable().addListener(listener); }
JobOperationListenerManager.java @OverRide public void start() { addConnectionStateListener(new ConnectionLostListener()); addDataListener(new JobTriggerStatusJobListener()); addDataListener(new JobPausedStatusJobListener()); addDataListener(new JobShutdownStatusJobListener()); }
The text was updated successfully, but these errors were encountered:
多谢帮忙分析bug,会在新版本中修复
Sorry, something went wrong.
fix #246
1b2b4b9
No branches or pull requests
问题描述见标题,我大概找到了问题原因:
主要是因为 JobScheduleController 在 shutdown 的时候没有同时释放 regCenter treeCache 缓存中的listenner,每次init() job 都会重复 addListener。( 这个问题应该不只是trigger有, 比如JobPausedStatusJobListenner 都可能会被重复add ),我现在的解决办法是在调用 JobScheduler init的之前先执行下面这段代码,这样可以避免这个问题:
val cachePath = "/" + job.getJobName();
val cache = (TreeCache) regCenter.getRawCache(cachePath);
if (cache != null) {
log.info("任务【" + job.getJobName() + "】clear regCenter cache " + cachePath);
cache.close();
regCenter.remove(cachePath);
}
我不是特别肯定这是程序bug,或者有其它的考虑,请亮哥判断下。
根本的问题是 Quartz 的 原生 schedule 里面的 trigger 对象被添加了好多次,如果重启服务器则不会有这个问题。
问题分析中源码的关键位置:
JobNodeStorage.java
/**
* 注册数据监听器.
*
* @param listener 数据监听器
*/
public void addDataListener(final TreeCacheListener listener) {
TreeCache cache = (TreeCache) regCenter.getRawCache("/" + jobName);
cache.getListenable().addListener(listener);
}
JobOperationListenerManager.java
@OverRide
public void start() {
addConnectionStateListener(new ConnectionLostListener());
addDataListener(new JobTriggerStatusJobListener());
addDataListener(new JobPausedStatusJobListener());
addDataListener(new JobShutdownStatusJobListener());
}
The text was updated successfully, but these errors were encountered: