|
|
|
@ -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"); |
|
|
|
|