Browse Source

REPORT-114392 FR-FBP版本本地设计适配 优化定时调度写法

fbp-1.0
Destiny.Lin 5 months ago
parent
commit
7fc07ebbeb
  1. 7
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java

7
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -169,13 +169,14 @@ public class DesignEnvComponent {
TenantContext.doIsolatedWork(() -> {
ClusterLock lock = ClusterBridge.getLockFactory().get(SchedulerCoreComponent.class);
// 多节点同时启动quartz模块可能会产生脏数据,导致报错,使用集群锁控制一下
DBSession dbSession = null;
try {
lock.lock();
final DBContextProvider context = BaseDBEnv.getDBContext();
if (context == null) {
throw new IllegalArgumentException("ConfigDBActivator must start before SchedulerActivator");
}
DBSession dbSession = context.openSession();
dbSession = context.openSession();
dbSession.doWork(new AbstractWork() {
@Override
@ -185,11 +186,13 @@ public class DesignEnvComponent {
QuartzContext.getInstance().initScheduler(properties);
}
});
dbSession.closeSession();
EventDispatcher.fire(SchedulerEvent.START);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
if (dbSession != null) {
dbSession.closeSession();
}
lock.unlock();
}
}, "default");

Loading…
Cancel
Save