12 changed files with 171 additions and 93 deletions
@ -0,0 +1,42 @@ |
|||||
|
package com.elink.esua.epdc.config; |
||||
|
|
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.core.task.TaskExecutor; |
||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
||||
|
|
||||
|
import java.util.concurrent.ThreadPoolExecutor; |
||||
|
|
||||
|
/** |
||||
|
* 线程池 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 18-11-27 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@EnableAsync |
||||
|
public class ThreadConfig { |
||||
|
|
||||
|
@Bean |
||||
|
public TaskExecutor taskExecutor() { |
||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
||||
|
// 设置核心线程数
|
||||
|
executor.setCorePoolSize(5); |
||||
|
// 设置最大线程数
|
||||
|
executor.setMaxPoolSize(10); |
||||
|
// 设置队列容量
|
||||
|
executor.setQueueCapacity(20); |
||||
|
// 设置线程活跃时间(秒)
|
||||
|
executor.setKeepAliveSeconds(60); |
||||
|
// 设置默认线程名称
|
||||
|
executor.setThreadNamePrefix("esd-"); |
||||
|
// 设置拒绝策略
|
||||
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
||||
|
// 等待所有任务结束后再关闭线程池
|
||||
|
executor.setWaitForTasksToCompleteOnShutdown(true); |
||||
|
executor.setAwaitTerminationSeconds(60); |
||||
|
executor.initialize(); |
||||
|
return executor; |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.elink.esua.epdc.enums; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户消息所属业务类型枚举 |
||||
|
* |
||||
|
* @author yujintao |
||||
|
* @email yujintao@elink-cn.com |
||||
|
* @date 2019/9/9 18:49 |
||||
|
*/ |
||||
|
public enum AppInformationBusinessEnum { |
||||
|
|
||||
|
/** |
||||
|
* 事件评论 |
||||
|
*/ |
||||
|
IMB_COMMENT("comment"), |
||||
|
/** |
||||
|
* 评论回复 |
||||
|
*/ |
||||
|
IMB_REPLY("reply"), |
||||
|
/** |
||||
|
* 议题处理 |
||||
|
*/ |
||||
|
IMB_ISSUE("issue"), |
||||
|
/** |
||||
|
* 社群邀请 |
||||
|
*/ |
||||
|
IMB_CROWD("crowd"); |
||||
|
|
||||
|
private String value; |
||||
|
|
||||
|
AppInformationBusinessEnum(String value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public String value() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.elink.esua.epdc.enums; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
||||
|
|
||||
|
/** |
||||
|
* 用户消息类型枚举 |
||||
|
* |
||||
|
* @author yujintao |
||||
|
* @email yujintao@elink-cn.com |
||||
|
* @date 2019/9/9 18:49 |
||||
|
*/ |
||||
|
public enum AppInformationEnum { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 0审核通知 |
||||
|
*/ |
||||
|
IM_AUDIT(NumConstant.ZERO_STR), |
||||
|
/** |
||||
|
* 1互动通知 |
||||
|
*/ |
||||
|
IM_COMMENT(NumConstant.ONE_STR), |
||||
|
/** |
||||
|
* 2进度通知 |
||||
|
*/ |
||||
|
IM_PROGRESS(NumConstant.TWO_STR), |
||||
|
/** |
||||
|
* 3社群通知 |
||||
|
*/ |
||||
|
IM_CROWD(NumConstant.THREE_STR); |
||||
|
|
||||
|
private String value; |
||||
|
|
||||
|
AppInformationEnum(String value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public String value() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue