| | |
| | | package com.java110.event.service.api; |
| | | |
| | | import com.java110.common.constant.CommonConstant; |
| | | import com.java110.common.constant.ResponseConstant; |
| | | import com.java110.common.constant.ServiceCodeConstant; |
| | | import com.java110.common.exception.BusinessException; |
| | | import com.java110.common.exception.ListenerExecuteException; |
| | | import com.java110.common.factory.ApplicationContextFactory; |
| | | import com.java110.common.log.LoggerEngine; |
| | | import com.java110.common.util.Assert; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.utils.exception.BusinessException; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.log.LoggerEngine; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.event.center.DataFlowListenerOrderComparator; |
| | | import com.java110.event.service.BusinessServiceDataFlowEvent; |
| | | import com.java110.event.service.BusinessServiceDataFlowListener; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | private static Executor taskExecutor; |
| | | |
| | | //默认 线程数 100 |
| | | private final static int DEFAULT_THREAD_NUM = 100; |
| | | private static final int DEFAULT_THREAD_NUM = 100; |
| | | |
| | | /** |
| | | * 保存侦听实例信息,一般启动时加载 |
| | | */ |
| | | private final static List<String> listeners = new ArrayList<String>(); |
| | | private static final List<String> listeners = new ArrayList<String>(); |
| | | |
| | | /** |
| | | * 根据 事件类型查询侦听 |
| | | */ |
| | | private final static Map<String, List<ServiceDataFlowListener>> cacheListenersMap = new HashMap<String, List<ServiceDataFlowListener>>(); |
| | | private static final Map<String, List<ServiceDataFlowListener>> cacheListenersMap = new HashMap<String, List<ServiceDataFlowListener>>(); |
| | | |
| | | /** |
| | | * 添加 侦听,这个只有启动时,单线程 处理,所以是线程安全的 |
| | |
| | | //这里排序 |
| | | DataFlowListenerOrderComparator.sort(dataFlowListeners); |
| | | |
| | | |
| | | //将数据放入缓存中 |
| | | cacheListenersMap.put(needCachedServiceCode, dataFlowListeners); |
| | | if (dataFlowListeners.size() > 0) { |
| | | cacheListenersMap.put(needCachedServiceCode, dataFlowListeners); |
| | | } |
| | | return dataFlowListeners; |
| | | } |
| | | |