0

当我尝试创建 Heron 的自定义调度程序并使用 SchedulerStateManagerApaptor 对象更新拓扑时,发生了此异常:

Exception in thread java.util.ConcurrentModificationException: The update lock can not be obtained for topology AuroraMonitorSentenceWordCountTopology. Another actor is performing an update on it. Failing this request, try again once current update is complete
    at com.twitter.heron.scheduler.UpdateTopologyManager.updateTopology(UpdateTopologyManager.java:117)
    at zyt.custom.my.scheduler.aurora.AuroraHotEdgeSchedulerWithTxtLog.triggerSchedule(AuroraHotEdgeSchedulerWithTxtLog.java:323)
    at zyt.custom.my.scheduler.aurora.AuroraHotEdgeSchedulerWithTxtLog.access$400(AuroraHotEdgeSchedulerWithTxtLog.java:55)
    at zyt.custom.my.scheduler.aurora.AuroraHotEdgeSchedulerWithTxtLog$2.run(AuroraHotEdgeSchedulerWithTxtLog.java:258)
    at java.lang.Thread.run(Thread.java:748)

以及实例化 SchedulerStateManagerAdaptor 对象的代码如下:

Config config = Config.toClusterMode(this.config);
String stateMgrClass = Context.stateManagerClass(config); // get state manager instance
IStateManager stateMgr = null;
try {
    stateMgr = ReflectionUtils.newInstance(stateMgrClass);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
    e.printStackTrace();
}
stateMgr.initialize(config);
return stateManagerAdaptor = new SchedulerStateManagerAdaptor(stateMgr, 1000); // 5000: timeout

如何解决此异常?谢谢你的帮助!

4

2 回答 2

0

Yitan - 你想创建一个新的 Aurora 调度器吗?

于 2018-07-03T16:16:04.267 回答
0

根据异常消息,当计划进行第二次更新操作时,会进行一次更新操作。第一个正在进行的操作阻止了第二个操作的进行。

那么你能干净地尝试更新操作吗?并且请检查您的实现是否在更新完成后正确释放锁?

于 2018-07-03T18:17:51.387 回答