diff --git a/o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/ThisApplication.java b/o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/ThisApplication.java index 76aee4af9d56c3879853565d7aee5310e786dae0..8ec2cf7be9d92b028b7d323bc5c5106393115db7 100644 --- a/o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/ThisApplication.java +++ b/o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/ThisApplication.java @@ -1,60 +1,63 @@ package com.x.attendance.assemble.control; +import org.apache.commons.lang3.BooleanUtils; + import com.x.attendance.assemble.control.processor.monitor.MonitorFileDataOpt; import com.x.attendance.assemble.control.processor.thread.DataProcessThreadFactory; -import com.x.attendance.assemble.control.schedule.*; +import com.x.attendance.assemble.control.schedule.AttendanceStatisticTask; +import com.x.attendance.assemble.control.schedule.DetailLastDayRecordAnalyseTask; +import com.x.attendance.assemble.control.schedule.DingdingAttendanceSyncScheduleTask; +import com.x.attendance.assemble.control.schedule.MobileRecordAnalyseTask; +import com.x.attendance.assemble.control.schedule.QywxAttendanceSyncScheduleTask; import com.x.attendance.assemble.control.service.AttendanceSettingService; import com.x.base.core.project.Context; import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.Config; import com.x.base.core.project.logger.LoggerFactory; -import org.apache.commons.lang3.BooleanUtils; - public class ThisApplication { + private ThisApplication() { + //nothing + } + protected static Context context; public static Context context() { return context; } - public static QueueDingdingAttendance dingdingQueue = new QueueDingdingAttendance(); - public static QueueQywxAttendanceSync qywxQueue = new QueueQywxAttendanceSync(); - public static QueueQywxUnitStatistic unitQywxStatisticQueue = new QueueQywxUnitStatistic(); - public static QueueQywxPersonStatistic personQywxStatisticQueue = new QueueQywxPersonStatistic(); - public static QueueDingdingPersonStatistic personStatisticQueue = new QueueDingdingPersonStatistic(); - public static QueueDingdingUnitStatistic unitStatisticQueue = new QueueDingdingUnitStatistic(); + public static final QueueDingdingAttendance dingdingQueue = new QueueDingdingAttendance(); + public static final QueueQywxAttendanceSync qywxQueue = new QueueQywxAttendanceSync(); + public static final QueueQywxUnitStatistic unitQywxStatisticQueue = new QueueQywxUnitStatistic(); + public static final QueueQywxPersonStatistic personQywxStatisticQueue = new QueueQywxPersonStatistic(); + public static final QueueDingdingPersonStatistic personStatisticQueue = new QueueDingdingPersonStatistic(); + public static final QueueDingdingUnitStatistic unitStatisticQueue = new QueueDingdingUnitStatistic(); - public static QueuePersonAttendanceDetailAnalyse detailAnalyseQueue = new QueuePersonAttendanceDetailAnalyse(); - public static QueueAttendanceDetailStatistic detailStatisticQueue = new QueueAttendanceDetailStatistic(); + public static final QueuePersonAttendanceDetailAnalyse detailAnalyseQueue = new QueuePersonAttendanceDetailAnalyse(); + public static final QueueAttendanceDetailStatistic detailStatisticQueue = new QueueAttendanceDetailStatistic(); public static void init() throws Exception { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_attendance_assemble_control()); new AttendanceSettingService().initAllSystemConfig(); - - detailAnalyseQueue.start(); - detailStatisticQueue.start(); + context.startQueue(detailAnalyseQueue); + context.startQueue(detailStatisticQueue); if (BooleanUtils.isTrue(Config.dingding().getAttendanceSyncEnable())) { - dingdingQueue.start(); - personStatisticQueue.start(); - unitStatisticQueue.start(); + context.startQueue(dingdingQueue); + context.startQueue(personStatisticQueue); + context.startQueue(unitStatisticQueue); context.schedule(DingdingAttendanceSyncScheduleTask.class, "0 0 1 * * ?"); // 已经将任务 放到了同步结束后执行 暂时不需要开定时任务了 -// context.schedule(DingdingAttendanceStatisticScheduleTask.class, "0 0 3 * * ?"); -// context.schedule(DingdingAttendanceStatisticPersonScheduleTask.class, "0 0 3 * * ?"); } if (BooleanUtils.isTrue(Config.qiyeweixin().getAttendanceSyncEnable())) { - qywxQueue.start(); - unitQywxStatisticQueue.start(); - personQywxStatisticQueue.start(); + context.startQueue(qywxQueue); + context.startQueue(unitQywxStatisticQueue); + context.startQueue(personQywxStatisticQueue); context.schedule(QywxAttendanceSyncScheduleTask.class, "0 0 1 * * ?"); } - context.schedule(AttendanceStatisticTask.class, "0 0 0/4 * * ?"); - context.schedule(MobileRecordAnalyseTask.class, "0 0 * * * ?"); // 每天凌晨1点,计算前一天所有的未签退和未分析的打卡数据 context.schedule(DetailLastDayRecordAnalyseTask.class, "0 0 1 * * ?"); @@ -68,43 +71,9 @@ public class ThisApplication { try { CacheManager.shutdown(); DataProcessThreadFactory.getInstance().showdown(); - } catch (Exception e) { - e.printStackTrace(); - } - try { MonitorFileDataOpt.stop(); } catch (Exception e) { e.printStackTrace(); } - try { - dingdingQueue.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - personStatisticQueue.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - unitStatisticQueue.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - qywxQueue.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - unitQywxStatisticQueue.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - personQywxStatisticQueue.stop(); - } catch (Exception e) { - e.printStackTrace(); - } } } \ No newline at end of file diff --git a/o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/ThisApplication.java b/o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/ThisApplication.java index 4a3210008d6f1ea830ddc497386b9e9fffc4fb66..7bee43a91e138d0aa487aac0c251f868fa51d7a8 100644 --- a/o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/ThisApplication.java +++ b/o2server/x_bbs_assemble_control/src/main/java/com/x/bbs/assemble/control/ThisApplication.java @@ -2,6 +2,8 @@ package com.x.bbs.assemble.control; import java.util.List; +import org.apache.commons.lang3.BooleanUtils; + import com.x.base.core.project.Context; import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.Config; @@ -26,10 +28,14 @@ import com.x.bbs.entity.BBSSectionInfo; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static final String BBSMANAGER = "BBSManager@CMSManagerSystemRole@R"; - public static QueueNewReplyNotify queueNewReplyNotify; - public static QueueNewSubjectNotify queueNewSubjectNotify; + public static final QueueNewReplyNotify queueNewReplyNotify = new QueueNewReplyNotify(); + public static final QueueNewSubjectNotify queueNewSubjectNotify = new QueueNewSubjectNotify(); public static String CONFIG_BBS_ANONYMOUS_PERMISSION = "YES"; public static Context context() { @@ -43,11 +49,7 @@ public class ThisApplication { CONFIG_BBS_ANONYMOUS_PERMISSION = (new BBSConfigSettingService()) .getValueWithConfigCode("BBS_ANONYMOUS_PERMISSION"); initAllSystemConfig(); - queueNewReplyNotify = new QueueNewReplyNotify(); - queueNewSubjectNotify = new QueueNewSubjectNotify(); - MessageConnector.start(context()); - context().startQueue(queueNewReplyNotify); context().startQueue(queueNewSubjectNotify); context.schedule(SubjectTotalStatisticTask.class, "0 0 1 * * ?"); // 每天凌晨一点执行 @@ -144,7 +146,7 @@ public class ThisApplication { * @return */ public static Boolean isForumManager(EffectivePerson effectivePerson, BBSForumInfo forumInfo) { - if (isBBSManager(effectivePerson)) { + if (BooleanUtils.isTrue(isBBSManager(effectivePerson))) { return true; } if (forumInfo != null && ListTools.isNotEmpty(forumInfo.getForumManagerList())) { diff --git a/o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/ThisApplication.java b/o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/ThisApplication.java index 653d6ae3701698b1a6afc8b691fbd1e269b264b7..2d3b65a45b9662155099e6eae3d55c87a74c2977 100644 --- a/o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/ThisApplication.java +++ b/o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/ThisApplication.java @@ -2,6 +2,8 @@ package com.x.calendar.assemble.control; import java.util.List; +import org.apache.commons.lang3.BooleanUtils; + import com.x.base.core.project.Context; import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.Config; @@ -17,6 +19,10 @@ import com.x.calendar.core.entity.Calendar_Event; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static final String CalendarMANAGER = "CalendarManager"; @@ -73,7 +79,7 @@ public class ThisApplication { * @return */ public static Boolean isCalendarManager(EffectivePerson effectivePerson, Calendar calendar) { - if (isCalendarSystemManager(effectivePerson)) { + if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) { return true; } if (calendar != null) { @@ -98,11 +104,11 @@ public class ThisApplication { */ public static Boolean isCalendarPublisher(EffectivePerson effectivePerson, List unitNames, List groupNames, Calendar calendar) { - if (isCalendarSystemManager(effectivePerson)) { + if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) { return true; } if (calendar != null) { - if (isCalendarManager(effectivePerson, calendar)) { + if (BooleanUtils.isTrue(isCalendarManager(effectivePerson, calendar))) { return true; } // 判断发布权限 @@ -142,13 +148,13 @@ public class ThisApplication { * @throws Exception */ public static Boolean isCalendarPublisher(EffectivePerson effectivePerson, Calendar calendar) throws Exception { - if (isCalendarSystemManager(effectivePerson)) { + if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) { return true; } List unitNames = null; List groupNames = null; if (calendar != null) { - if (isCalendarManager(effectivePerson, calendar)) { + if (BooleanUtils.isTrue(isCalendarManager(effectivePerson, calendar))) { return true; } UserManagerService userManagerService = new UserManagerService(); @@ -192,7 +198,7 @@ public class ThisApplication { */ public static Boolean isEventManager(EffectivePerson effectivePerson, Calendar calendar, Calendar_Event event) throws Exception { - if (isCalendarSystemManager(effectivePerson)) { + if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) { return true; } List unitNames = null; @@ -203,7 +209,7 @@ public class ThisApplication { unitNames = userManagerService.listUnitNamesWithPerson(personName); groupNames = userManagerService.listGroupNamesByPerson(personName); // 判断日历的发布权限 - if (isCalendarPublisher(effectivePerson, unitNames, groupNames, calendar)) { + if (BooleanUtils.isTrue(isCalendarPublisher(effectivePerson, unitNames, groupNames, calendar))) { return true; } // 判断事件的管理权限 diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/ThisApplication.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/ThisApplication.java index b0e2db58c0401decc795f41d8b3d9354cdc3932c..fa24be5827335aa654106afd237fabd11a62f383 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/ThisApplication.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/ThisApplication.java @@ -1,6 +1,7 @@ package com.x.cms.assemble.control; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import com.x.base.core.project.Context; import com.x.base.core.project.cache.CacheManager; @@ -22,17 +23,27 @@ import com.x.cms.assemble.control.timertask.Timertask_RefreshAllDocumentReviews; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static final String ROLE_CMSManager = "CMSManager@CMSManagerSystemRole@R"; public static final String ROLE_Manager = "Manager@ManagerSystemRole@R"; - public static QueueDataRowImport queueDataRowImport; - public static QueueDocumentDelete queueDocumentDelete; - public static QueueDocumentUpdate queueDocumentUpdate; - public static QueueDocumentViewCountUpdate queueDocumentViewCountUpdate; - public static QueueBatchOperation queueBatchOperation; - public static QueueSendDocumentNotify queueSendDocumentNotify; - private static ConcurrentHashMap importStatus = new ConcurrentHashMap<>(); + // 文档批量导入时数据存储过程 + public static final QueueDataRowImport queueDataRowImport = new QueueDataRowImport(); + // Document删除时也需要检查一下热点图片里的数据是否已经删除掉了 + public static final QueueDocumentDelete queueDocumentDelete = new QueueDocumentDelete(); + // Document变更标题时也需要更新一下热点图片里的数据 + public static final QueueDocumentUpdate queueDocumentUpdate = new QueueDocumentUpdate(); + // Document被访问时,需要将总的访问量更新到item的document中,便于视图使用,在队列里异步修改 + public static final QueueDocumentViewCountUpdate queueDocumentViewCountUpdate = new QueueDocumentViewCountUpdate(); + // 执行数据库中的批处理操作 + public static final QueueBatchOperation queueBatchOperation = new QueueBatchOperation(); + // Document发布时,向所有阅读者推送通知 + public static final QueueSendDocumentNotify queueSendDocumentNotify = new QueueSendDocumentNotify(); + private static final ConcurrentHashMap importStatus = new ConcurrentHashMap<>(); public static Context context() { return context; @@ -41,21 +52,7 @@ public class ThisApplication { public static void init() throws Exception { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_cms_assemble_control()); - // 执行数据库中的批处理操作 - queueBatchOperation = new QueueBatchOperation(); - // Document删除时也需要检查一下热点图片里的数据是否已经删除掉了 - queueDocumentDelete = new QueueDocumentDelete(); - // 文档批量导入时数据存储过程 - queueDataRowImport = new QueueDataRowImport(); - // Document变更标题时也需要更新一下热点图片里的数据 - queueDocumentUpdate = new QueueDocumentUpdate(); - // Document被访问时,需要将总的访问量更新到item的document中,便于视图使用,在队列里异步修改 - queueDocumentViewCountUpdate = new QueueDocumentViewCountUpdate(); - // Document发布时,向所有阅读者推送通知 - queueSendDocumentNotify = new QueueSendDocumentNotify(); - MessageConnector.start(context()); - context().startQueue(queueBatchOperation); context().startQueue(queueDocumentDelete); context().startQueue(queueDataRowImport); @@ -77,18 +74,12 @@ public class ThisApplication { public static void destroy() { try { CacheManager.shutdown(); - queueBatchOperation.stop(); - queueDocumentDelete.stop(); - queueDataRowImport.stop(); - queueDocumentUpdate.stop(); - queueDocumentViewCountUpdate.stop(); - queueSendDocumentNotify.stop(); } catch (Exception e) { e.printStackTrace(); } } - public static ConcurrentHashMap listImportStatus() { + public static ConcurrentMap listImportStatus() { return importStatus; } diff --git a/o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java b/o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java index 2040d08a06dacb653bd56093da12a19d2eb02a84..26e7a927b51383bd341a72a5d728f0fa48d5ce70 100644 --- a/o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java +++ b/o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java @@ -9,7 +9,11 @@ import com.x.file.assemble.control.jaxrs.file.FileRemoveQueue; public class ThisApplication { - public static FileRemoveQueue fileRemoveQueue; + private ThisApplication() { + // nothing + } + + public static final FileRemoveQueue fileRemoveQueue = new FileRemoveQueue(); protected static Context context; @@ -21,7 +25,6 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_file_assemble_control()); - fileRemoveQueue = new FileRemoveQueue(); MessageConnector.start(context()); context().startQueue(fileRemoveQueue); } catch (Exception e) { diff --git a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/ThisApplication.java b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/ThisApplication.java index c317a721fff6afe6751c661bebb2d3fb2bd8b5b9..be4730cb7ce0779b1ab40282b47d1f88ee55f9cd 100644 --- a/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/ThisApplication.java +++ b/o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_hotpic_assemble_control/src/main/java/com/x/hotpic/assemble/control/ThisApplication.java b/o2server/x_hotpic_assemble_control/src/main/java/com/x/hotpic/assemble/control/ThisApplication.java index 49e47d8993bce37bf3e393d76bda765313cd13cf..a6496687aeddc2af15f0ea4964bcf1ab2d9ae64c 100644 --- a/o2server/x_hotpic_assemble_control/src/main/java/com/x/hotpic/assemble/control/ThisApplication.java +++ b/o2server/x_hotpic_assemble_control/src/main/java/com/x/hotpic/assemble/control/ThisApplication.java @@ -9,7 +9,11 @@ import com.x.hotpic.assemble.control.schedule.InfoExistsCheckTask; public class ThisApplication { - public static DocumentExistsCheckTask queueLoginRecord; + private ThisApplication() { + // nothing + } + + public static final DocumentExistsCheckTask queueLoginRecord = new DocumentExistsCheckTask(); protected static Context context; public static Context context() { @@ -20,7 +24,6 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_hotpic_assemble_control()); - queueLoginRecord = new DocumentExistsCheckTask(); context.startQueue(queueLoginRecord); context.schedule(InfoExistsCheckTask.class, "0 0/10 * * * ?"); } catch (Exception e) { diff --git a/o2server/x_jpush_assemble_control/src/main/java/com/x/jpush/assemble/control/ThisApplication.java b/o2server/x_jpush_assemble_control/src/main/java/com/x/jpush/assemble/control/ThisApplication.java index 3909dc913b7abc7add7b324d894cf01dcd14adc3..ef657aaa18a1061ce649493933cf7235d2867c0c 100644 --- a/o2server/x_jpush_assemble_control/src/main/java/com/x/jpush/assemble/control/ThisApplication.java +++ b/o2server/x_jpush_assemble_control/src/main/java/com/x/jpush/assemble/control/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/ThisApplication.java b/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/ThisApplication.java index b51898e7b725e89769b9246363a29d452be9e3f7..29a35190b06a050dac7bb006ed46d72a0d966a48 100644 --- a/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/ThisApplication.java +++ b/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/ThisApplication.java @@ -8,6 +8,10 @@ import com.x.base.core.project.message.MessageConnector; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ThisApplication.java b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ThisApplication.java index 33f1c27c0a2bd033232f30b4d415eaec6decfc5a..69e0dc00668c7522c31e1f8a2ddd3238d6bf682c 100644 --- a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ThisApplication.java +++ b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ThisApplication.java @@ -1,37 +1,40 @@ package com.x.message.assemble.communicate; -import com.x.base.core.project.message.MessageConnector; import org.apache.commons.lang3.BooleanUtils; import com.x.base.core.project.Context; import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.config.Config; import com.x.base.core.project.logger.LoggerFactory; +import com.x.base.core.project.message.MessageConnector; import com.x.message.assemble.communicate.schedule.Clean; import com.x.message.assemble.communicate.schedule.TriggerMq; -import com.x.message.core.entity.Message; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; - public static WsConsumeQueue wsConsumeQueue = new WsConsumeQueue(); + public static final WsConsumeQueue wsConsumeQueue = new WsConsumeQueue(); - public static PmsConsumeQueue pmsConsumeQueue = new PmsConsumeQueue(); + public static final PmsConsumeQueue pmsConsumeQueue = new PmsConsumeQueue(); - public static CalendarConsumeQueue calendarConsumeQueue = new CalendarConsumeQueue(); + public static final CalendarConsumeQueue calendarConsumeQueue = new CalendarConsumeQueue(); - public static QiyeweixinConsumeQueue qiyeweixinConsumeQueue = new QiyeweixinConsumeQueue(); + public static final QiyeweixinConsumeQueue qiyeweixinConsumeQueue = new QiyeweixinConsumeQueue(); - public static ZhengwuDingdingConsumeQueue zhengwuDingdingConsumeQueue = new ZhengwuDingdingConsumeQueue(); + public static final ZhengwuDingdingConsumeQueue zhengwuDingdingConsumeQueue = new ZhengwuDingdingConsumeQueue(); - public static DingdingConsumeQueue dingdingConsumeQueue = new DingdingConsumeQueue(); + public static final DingdingConsumeQueue dingdingConsumeQueue = new DingdingConsumeQueue(); - public static WeLinkConsumeQueue weLinkConsumeQueue = new WeLinkConsumeQueue(); + public static final WeLinkConsumeQueue weLinkConsumeQueue = new WeLinkConsumeQueue(); - public static PmsInnerConsumeQueue pmsInnerConsumeQueue = new PmsInnerConsumeQueue(); + public static final PmsInnerConsumeQueue pmsInnerConsumeQueue = new PmsInnerConsumeQueue(); - public static MQConsumeQueue mqConsumeQueue = new MQConsumeQueue(); + public static final MQConsumeQueue mqConsumeQueue = new MQConsumeQueue(); public static Context context() { return context; @@ -41,62 +44,57 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_message_assemble_communicate()); - if (Config.communicate().wsEnable()) { - wsConsumeQueue.start(); - } - if (Config.communicate().pmsEnable()) { - pmsConsumeQueue.start(); - } - if (Config.communicate().calendarEnable()) { - calendarConsumeQueue.start(); - } + + MessageConnector.start(context()); + startQueue(); if (BooleanUtils.isTrue(Config.communicate().clean().getEnable())) { context().schedule(Clean.class, Config.communicate().clean().getCron()); } - if (BooleanUtils.isTrue(Config.qiyeweixin().getEnable()) - && BooleanUtils.isTrue(Config.qiyeweixin().getMessageEnable())) { - qiyeweixinConsumeQueue.start(); - } - if (BooleanUtils.isTrue(Config.zhengwuDingding().getEnable()) - && BooleanUtils.isTrue(Config.zhengwuDingding().getMessageEnable())) { - zhengwuDingdingConsumeQueue.start(); - } - if (Config.dingding().getEnable() && Config.dingding().getMessageEnable()) { - dingdingConsumeQueue.start(); - } - if (BooleanUtils.isTrue(Config.pushConfig().getEnable())) { - pmsInnerConsumeQueue.start(); - } - if (Config.weLink().getEnable() && Config.weLink().getMessageEnable()) { - weLinkConsumeQueue.start(); - } - - if (Config.mq().getEnable()) { - mqConsumeQueue.start(); - } - - MessageConnector.start(context()); - if (BooleanUtils.isTrue(Config.communicate().cronMq().getEnable())) { context().schedule(TriggerMq.class, Config.communicate().cronMq().getCron()); } - } catch (Exception e) { e.printStackTrace(); } } + private static void startQueue() throws Exception { + if (BooleanUtils.isTrue(Config.communicate().wsEnable())) { + context().startQueue(wsConsumeQueue); + } + if (BooleanUtils.isTrue(Config.communicate().pmsEnable())) { + context().startQueue(pmsConsumeQueue); + } + if (BooleanUtils.isTrue(Config.communicate().calendarEnable())) { + context().startQueue(calendarConsumeQueue); + } + + if (BooleanUtils.isTrue(Config.qiyeweixin().getEnable()) + && BooleanUtils.isTrue(Config.qiyeweixin().getMessageEnable())) { + context().startQueue(qiyeweixinConsumeQueue); + } + if (BooleanUtils.isTrue(Config.zhengwuDingding().getEnable()) + && BooleanUtils.isTrue(Config.zhengwuDingding().getMessageEnable())) { + context().startQueue(zhengwuDingdingConsumeQueue); + } + if (Config.dingding().getEnable() && Config.dingding().getMessageEnable()) { + context().startQueue(dingdingConsumeQueue); + } + if (BooleanUtils.isTrue(Config.pushConfig().getEnable())) { + context().startQueue(pmsInnerConsumeQueue); + } + if (Config.weLink().getEnable() && Config.weLink().getMessageEnable()) { + context().startQueue(weLinkConsumeQueue); + } + + if (BooleanUtils.isTrue(Config.mq().getEnable())) { + context().startQueue(mqConsumeQueue); + } + } + public static void destroy() { try { CacheManager.shutdown(); - wsConsumeQueue.stop(); - pmsConsumeQueue.stop(); - calendarConsumeQueue.stop(); - qiyeweixinConsumeQueue.stop(); - zhengwuDingdingConsumeQueue.stop(); - dingdingConsumeQueue.stop(); - pmsInnerConsumeQueue.stop(); - weLinkConsumeQueue.stop(); MessageConnector.stop(); } catch (Exception e) { e.printStackTrace(); diff --git a/o2server/x_mind_assemble_control/src/main/java/com/x/mind/assemble/control/ThisApplication.java b/o2server/x_mind_assemble_control/src/main/java/com/x/mind/assemble/control/ThisApplication.java index 84e0b1201a536c8c1ffe07a04d7bfd35903e22ce..02e1abc2e1f827783c52a9b34aafab4d7326994d 100644 --- a/o2server/x_mind_assemble_control/src/main/java/com/x/mind/assemble/control/ThisApplication.java +++ b/o2server/x_mind_assemble_control/src/main/java/com/x/mind/assemble/control/ThisApplication.java @@ -8,8 +8,13 @@ import com.x.base.core.project.message.MessageConnector; import com.x.mind.assemble.control.queue.QueueShareNotify; public class ThisApplication { + + private ThisApplication() { + // nothing + } + protected static Context context; - public static QueueShareNotify queueShareNotify; + public static final QueueShareNotify queueShareNotify = new QueueShareNotify(); public static Context context() { return context; @@ -19,7 +24,6 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_mind_assemble_control()); - queueShareNotify = new QueueShareNotify(); MessageConnector.start(context()); context().startQueue(queueShareNotify); } catch (Exception e) { diff --git a/o2server/x_mind_assemble_control/src/main/webapp/describe/sources/com/x/mind/assemble/control/ThisApplication.java b/o2server/x_mind_assemble_control/src/main/webapp/describe/sources/com/x/mind/assemble/control/ThisApplication.java index 924cccb7ec11fc0937195785c305f71b705b1099..02e1abc2e1f827783c52a9b34aafab4d7326994d 100644 --- a/o2server/x_mind_assemble_control/src/main/webapp/describe/sources/com/x/mind/assemble/control/ThisApplication.java +++ b/o2server/x_mind_assemble_control/src/main/webapp/describe/sources/com/x/mind/assemble/control/ThisApplication.java @@ -8,8 +8,13 @@ import com.x.base.core.project.message.MessageConnector; import com.x.mind.assemble.control.queue.QueueShareNotify; public class ThisApplication { + + private ThisApplication() { + // nothing + } + protected static Context context; - public static QueueShareNotify queueShareNotify; + public static final QueueShareNotify queueShareNotify = new QueueShareNotify(); public static Context context() { return context; @@ -19,7 +24,6 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_mind_assemble_control()); - queueShareNotify = new QueueShareNotify(); MessageConnector.start(context()); context().startQueue(queueShareNotify); } catch (Exception e) { @@ -30,6 +34,7 @@ public class ThisApplication { public static void destroy() { try { + CacheManager.shutdown(); queueShareNotify.stop(); } catch (Exception e) { e.printStackTrace(); diff --git a/o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/ThisApplication.java b/o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/ThisApplication.java index 2e2843b404cdf18a119a83b7aa465d6ce1614d75..e235ce5c60a990bbc759176a5796a9858a201d1e 100644 --- a/o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/ThisApplication.java +++ b/o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/ThisApplication.java @@ -20,13 +20,17 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Map importFileStatusMap = new HashMap(); public static final String OKRMANAGER = "OKRManager"; - public static QueueWorkDynamicRecord queueWorkDynamicRecord; + public static final QueueWorkDynamicRecord queueWorkDynamicRecord = new QueueWorkDynamicRecord(); public static Context context() { return context; @@ -36,11 +40,8 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_okr_assemble_control()); - queueWorkDynamicRecord = new QueueWorkDynamicRecord(); context().startQueue(queueWorkDynamicRecord); - new OkrConfigSystemService().initAllSystemConfig(); - // 每天凌晨2点执行一次 context.schedule(St_WorkReportContent.class, "0 0 2 * * ?"); // 每天凌晨2点30执行一次 diff --git a/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/ThisApplication.java b/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/ThisApplication.java index 69ce2a03b516a781e88b5a31b1af4116396dd79a..e235ce5c60a990bbc759176a5796a9858a201d1e 100644 --- a/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/ThisApplication.java +++ b/o2server/x_okr_assemble_control/src/main/webapp/describe/sources/com/x/okr/assemble/control/ThisApplication.java @@ -20,13 +20,17 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Map importFileStatusMap = new HashMap(); public static final String OKRMANAGER = "OKRManager"; - public static QueueWorkDynamicRecord queueWorkDynamicRecord; + public static final QueueWorkDynamicRecord queueWorkDynamicRecord = new QueueWorkDynamicRecord(); public static Context context() { return context; @@ -36,11 +40,8 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_okr_assemble_control()); - queueWorkDynamicRecord = new QueueWorkDynamicRecord(); context().startQueue(queueWorkDynamicRecord); - new OkrConfigSystemService().initAllSystemConfig(); - // 每天凌晨2点执行一次 context.schedule(St_WorkReportContent.class, "0 0 2 * * ?"); // 每天凌晨2点30执行一次 @@ -63,6 +64,7 @@ public class ThisApplication { public static void destroy() { try { + CacheManager.shutdown(); } catch (Exception e) { e.printStackTrace(); } diff --git a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/ThisApplication.java b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/ThisApplication.java index 419c9f6629b9796db5d505ebedab9f150cac1f29..5ca5b262c049fac4a8cd2964d266aaabc7e83798 100644 --- a/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/ThisApplication.java +++ b/o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/ThisApplication.java @@ -10,7 +10,11 @@ import com.x.organization.assemble.authentication.schedule.CleanupOauthCode; public class ThisApplication { - public static QueueLoginRecord queueLoginRecord; + private ThisApplication() { + // nothing + } + + public static final QueueLoginRecord queueLoginRecord = new QueueLoginRecord(); protected static Context context; @@ -22,7 +26,6 @@ public class ThisApplication { try { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_organization_assemble_authentication()); - queueLoginRecord = new QueueLoginRecord(); context.startQueue(queueLoginRecord); context.schedule(CleanupBind.class, "0 */15 * * * ?"); context.schedule(CleanupOauthCode.class, "0 */15 * * * ?"); diff --git a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/ThisApplication.java b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/ThisApplication.java index 5016cc065fa41b3a547290c8b3732c015149d0e7..ea68c71b32c2def81e2e8dba5e0b4875c4b71468 100644 --- a/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/ThisApplication.java +++ b/o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/ThisApplication.java b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/ThisApplication.java index 5d13264f06b25943720368b56cde5e4ff1d0d997..7f1597c2e51d0f57b467a4d57b2c12e323218a4f 100644 --- a/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/ThisApplication.java +++ b/o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/ThisApplication.java b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/ThisApplication.java index a1f0b4650e44484cb5d228dd964f974a55d8d3ea..d90cf0b38f4cba7930e2ab631cc7ca6091d2b8d6 100644 --- a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/ThisApplication.java +++ b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/ThisApplication.java @@ -8,6 +8,10 @@ import com.x.organization.assemble.personal.schedule.DisableExpiredEmpower; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/ThisApplication.java b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/ThisApplication.java index d801b4b8343f83657bb707c144266783ef015ed6..7b9dd8ecf72f422722737ff00879ef15ed62fecd 100644 --- a/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/ThisApplication.java +++ b/o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/ThisApplication.java b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/ThisApplication.java index aafa0e2c0071e63285afbfb2bf1e74e35e64152a..37c20673ed86d1081d1c218fbb9fcf3819a194fa 100644 --- a/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/ThisApplication.java +++ b/o2server/x_portal_assemble_surface/src/main/java/com/x/portal/assemble/surface/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_portal_assemble_surface/src/main/webapp/describe/sources/com/x/portal/assemble/surface/ThisApplication.java b/o2server/x_portal_assemble_surface/src/main/webapp/describe/sources/com/x/portal/assemble/surface/ThisApplication.java index 98c9c02a560e37bf851e2ff08b2aad0c636d2b30..37c20673ed86d1081d1c218fbb9fcf3819a194fa 100644 --- a/o2server/x_portal_assemble_surface/src/main/webapp/describe/sources/com/x/portal/assemble/surface/ThisApplication.java +++ b/o2server/x_portal_assemble_surface/src/main/webapp/describe/sources/com/x/portal/assemble/surface/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { @@ -24,6 +28,7 @@ public class ThisApplication { public static void destroy() { try { + CacheManager.shutdown(); } catch (Exception e) { e.printStackTrace(); } diff --git a/o2server/x_processplatform_assemble_bam/src/main/java/com/x/processplatform/assemble/bam/ThisApplication.java b/o2server/x_processplatform_assemble_bam/src/main/java/com/x/processplatform/assemble/bam/ThisApplication.java index d15ffda7fa67aaea9035e1f78516d1415c8d7c70..1ad322a71e405b6e837b7bc2561acc96cba3a660 100644 --- a/o2server/x_processplatform_assemble_bam/src/main/java/com/x/processplatform/assemble/bam/ThisApplication.java +++ b/o2server/x_processplatform_assemble_bam/src/main/java/com/x/processplatform/assemble/bam/ThisApplication.java @@ -11,6 +11,10 @@ import com.x.processplatform.assemble.bam.schedule.StateTimer; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_processplatform_assemble_bam/src/main/webapp/describe/sources/com/x/processplatform/assemble/bam/ThisApplication.java b/o2server/x_processplatform_assemble_bam/src/main/webapp/describe/sources/com/x/processplatform/assemble/bam/ThisApplication.java index 19874f3f33123457301588e40e03b4cc392bd383..1ad322a71e405b6e837b7bc2561acc96cba3a660 100644 --- a/o2server/x_processplatform_assemble_bam/src/main/webapp/describe/sources/com/x/processplatform/assemble/bam/ThisApplication.java +++ b/o2server/x_processplatform_assemble_bam/src/main/webapp/describe/sources/com/x/processplatform/assemble/bam/ThisApplication.java @@ -11,6 +11,10 @@ import com.x.processplatform.assemble.bam.schedule.StateTimer; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { @@ -31,6 +35,7 @@ public class ThisApplication { public static void destroy() { try { + CacheManager.shutdown(); } catch (Exception e) { e.printStackTrace(); } diff --git a/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/ThisApplication.java b/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/ThisApplication.java index 28c4a514e9b38a89772009ca04d2059551c4ede1..a9575e7e8820a42b073e1642bf6609743ff03b0d 100644 --- a/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/ThisApplication.java +++ b/o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/ThisApplication.java @@ -8,13 +8,17 @@ import com.x.base.core.project.message.MessageConnector; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; - public static ProjectionExecuteQueue projectionExecuteQueue = new ProjectionExecuteQueue(); - public static MappingExecuteQueue mappingExecuteQueue = new MappingExecuteQueue(); - public static FormVersionQueue formVersionQueue = new FormVersionQueue(); - public static ProcessVersionQueue processVersionQueue = new ProcessVersionQueue(); - public static ScriptVersionQueue scriptVersionQueue = new ScriptVersionQueue(); + public static final ProjectionExecuteQueue projectionExecuteQueue = new ProjectionExecuteQueue(); + public static final MappingExecuteQueue mappingExecuteQueue = new MappingExecuteQueue(); + public static final FormVersionQueue formVersionQueue = new FormVersionQueue(); + public static final ProcessVersionQueue processVersionQueue = new ProcessVersionQueue(); + public static final ScriptVersionQueue scriptVersionQueue = new ScriptVersionQueue(); public static Context context() { return context; @@ -25,11 +29,11 @@ public class ThisApplication { CacheManager.init(context.clazz().getSimpleName()); LoggerFactory.setLevel(Config.logLevel().x_processplatform_assemble_designer()); MessageConnector.start(context()); - projectionExecuteQueue.start(); - mappingExecuteQueue.start(); - formVersionQueue.start(); - processVersionQueue.start(); - scriptVersionQueue.start(); + context().startQueue(projectionExecuteQueue); + context().startQueue(mappingExecuteQueue); + context().startQueue(formVersionQueue); + context().startQueue(processVersionQueue); + context().startQueue(scriptVersionQueue); } catch (Exception e) { e.printStackTrace(); } @@ -38,11 +42,6 @@ public class ThisApplication { public static void destroy() { try { CacheManager.shutdown(); - projectionExecuteQueue.stop(); - mappingExecuteQueue.stop(); - formVersionQueue.stop(); - processVersionQueue.stop(); - scriptVersionQueue.stop(); MessageConnector.stop(); } catch (Exception e) { e.printStackTrace(); diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ThisApplication.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ThisApplication.java index e4290d45f14651bc725398ddcedf36f0b73ba9ca..d1b128bf72a8175fbed3f918c660fd125e4a81e9 100644 --- a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ThisApplication.java +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/ThisApplication.java @@ -8,6 +8,10 @@ import com.x.processplatform.assemble.surface.schedule.CleanKeyLock; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ThisApplication.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ThisApplication.java index 8d4b3f27ea92b85499de99c0019c17c6def868c8..96ea8133d93b4b72df59b84426ba79155890d8bc 100644 --- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ThisApplication.java +++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/ThisApplication.java @@ -21,13 +21,17 @@ import org.apache.commons.lang3.BooleanUtils; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; - public static SyncJaxrsInvokeQueue syncJaxrsInvokeQueue = new SyncJaxrsInvokeQueue(); + public static final SyncJaxrsInvokeQueue syncJaxrsInvokeQueue = new SyncJaxrsInvokeQueue(); - public static SyncJaxwsInvokeQueue syncJaxwsInvokeQueue = new SyncJaxwsInvokeQueue(); + public static final SyncJaxwsInvokeQueue syncJaxwsInvokeQueue = new SyncJaxwsInvokeQueue(); - public static SyncEmbedQueue syncEmbedQueue = new SyncEmbedQueue(); + public static final SyncEmbedQueue syncEmbedQueue = new SyncEmbedQueue(); public static Context context() { return context; diff --git a/o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java b/o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java index 2602ffd5edbf710c9bcdbb69b5d22ebdcb930083..5e5ee68c195bd08988f1d3a4d86eed46cb681dbf 100644 --- a/o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java +++ b/o2server/x_program_center/src/main/java/com/x/program/center/ThisApplication.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.apache.commons.lang3.BooleanUtils; + import com.google.gson.internal.LinkedTreeMap; import com.x.base.core.project.config.Config; import com.x.base.core.project.logger.LoggerFactory; @@ -28,23 +30,27 @@ import com.x.program.center.schedule.ZhengwuDingdingSyncOrganizationTrigger; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { return context; } - public static CenterQueue centerQueue = new CenterQueue(); + public static final CenterQueue centerQueue = new CenterQueue(); - public static LogQueue logQueue = new LogQueue(); + public static final LogQueue logQueue = new LogQueue(); - public static List dingdingSyncOrganizationCallbackRequest = new ArrayList<>(); + public static final List dingdingSyncOrganizationCallbackRequest = new ArrayList<>(); - public static List weLinkSyncOrganizationCallbackRequest = new ArrayList<>(); + public static final List weLinkSyncOrganizationCallbackRequest = new ArrayList<>(); - public static List zhengwuDingdingSyncOrganizationCallbackRequest = new ArrayList<>(); + public static final List zhengwuDingdingSyncOrganizationCallbackRequest = new ArrayList<>(); - public static List qiyeweixinSyncOrganizationCallbackRequest = new ArrayList<>(); + public static final List qiyeweixinSyncOrganizationCallbackRequest = new ArrayList<>(); public static Map> metricsReportMap = new ConcurrentHashMap<>(); @@ -56,7 +62,7 @@ public class ThisApplication { context().startQueue(logQueue); /* 政务钉钉拉入同步 */ - if (Config.zhengwuDingding().getEnable()) { + if (BooleanUtils.isNotTrue(Config.zhengwuDingding().getEnable())) { /* 启动同步任务 */ context().scheduleLocal(ZhengwuDingdingSyncOrganization.class, Config.zhengwuDingding().getSyncCron()); /* 添加一个强制同步任务 */ @@ -64,7 +70,7 @@ public class ThisApplication { Config.zhengwuDingding().getForceSyncCron()); } /* 企业微信拉入同步 */ - if (Config.qiyeweixin().getEnable()) { + if (BooleanUtils.isNotTrue(Config.qiyeweixin().getEnable())) { /* 启动同步任务 */ context().scheduleLocal(QiyeweixinSyncOrganization.class, Config.qiyeweixin().getSyncCron()); /* 添加一个强制同步任务 */ @@ -72,14 +78,14 @@ public class ThisApplication { Config.qiyeweixin().getForceSyncCron()); } /* 钉钉同步 */ - if (Config.dingding().getEnable()) { + if (BooleanUtils.isNotTrue(Config.dingding().getEnable())) { /* 启动同步任务 */ context().scheduleLocal(DingdingSyncOrganization.class, Config.dingding().getSyncCron()); /* 添加一个强制同步任务 */ context().scheduleLocal(DingdingSyncOrganizationTrigger.class, Config.dingding().getForceSyncCron()); } /* WeLink同步 */ - if (Config.weLink().getEnable()) { + if (BooleanUtils.isNotTrue(Config.weLink().getEnable())) { /* 启动同步任务 */ context().scheduleLocal(WeLinkSyncOrganization.class, Config.weLink().getSyncCron()); /* 添加一个强制同步任务 */ diff --git a/o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/ThisApplication.java b/o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/ThisApplication.java index 8538833374d592ff1e12c8ac2e61b12b1ac799d5..17e77f990a7ad07266c0867615484e05005d73c0 100644 --- a/o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/ThisApplication.java +++ b/o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/ThisApplication.java b/o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/ThisApplication.java index aa735831659c52e2b17c439d640f2d8ee19482bc..57b43fd6c7f49a3dbbc9c2620c65a9aad56f18a0 100644 --- a/o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/ThisApplication.java +++ b/o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/ThisApplication.java @@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/ThisApplication.java b/o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/ThisApplication.java index 50ddc7c12b214a71190cef28f97f134ac70c2740..d10130b7c3efcb7d6a721db2342a8baa06966047 100644 --- a/o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/ThisApplication.java +++ b/o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/ThisApplication.java @@ -12,6 +12,10 @@ import com.x.query.service.processing.schedule.CrawlWorkCompleted; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/ThisApplication.java b/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/ThisApplication.java index 50ddc7c12b214a71190cef28f97f134ac70c2740..d10130b7c3efcb7d6a721db2342a8baa06966047 100644 --- a/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/ThisApplication.java +++ b/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/ThisApplication.java @@ -12,6 +12,10 @@ import com.x.query.service.processing.schedule.CrawlWorkCompleted; public class ThisApplication { + private ThisApplication() { + // nothing + } + protected static Context context; public static Context context() { diff --git a/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/ActionGroup2.java b/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/ActionGroup2.java index 13ab5f67b97267659af0872a44f0631f944947c7..6a4e8c136e4f9e0aa9e36badefe9343ba2b4898c 100644 --- a/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/ActionGroup2.java +++ b/o2server/x_query_service_processing/src/main/webapp/describe/sources/com/x/query/service/processing/jaxrs/test/ActionGroup2.java @@ -1,6 +1,11 @@ package com.x.query.service.processing.jaxrs.test; +import java.util.ArrayList; + +import javax.script.Bindings; +import javax.script.ScriptContext; import javax.script.ScriptEngine; +import javax.script.SimpleScriptContext; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; @@ -19,7 +24,12 @@ class ActionGroup2 extends BaseAction { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult result = new ActionResult<>(); ScriptEngine engine = ScriptFactory.newScriptEngine(); - Object o = engine.eval("this.data && this.data.length"); + ScriptContext scriptContext = new SimpleScriptContext(); + Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE); + bindings.put("data", new ArrayList<>()); + engine.setContext(scriptContext); + engine.eval("var o = this.data && this.data.length;"); + Object o = engine.eval("o;"); System.out.println(o.getClass()); return result; }