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

Loading…
Cancel
Save