Authored by chaogeng

update

... ... @@ -5,4 +5,6 @@ import java.util.concurrent.ScheduledExecutorService;
public class Const {
public static final ScheduledExecutorService LUCKYDRAW_EXE = Executors.newScheduledThreadPool(1);
public static final ScheduledExecutorService LUCKYUSERNOTICE_EXE = Executors.newScheduledThreadPool(1);
}
... ...
... ... @@ -58,4 +58,13 @@ public class TimeTaskRest {
apiResponse.setData(jsonArray);
return apiResponse;
}
@RequestMapping("/shutdownLuckyUserNotice")
@ResponseBody
public ApiResponse shutdownLuckyUserNotice() {
logger.info("Enter shutdownLuckyUserNotice.");
timeTaskService.shutdownLuckyUserNotice();
return new ApiResponse();
}
}
... ...
... ... @@ -20,5 +20,7 @@ public interface ITimeTaskService {
*
*/
JSONArray luckyUserNotice();
void shutdownLuckyUserNotice();
}
... ...
... ... @@ -262,4 +262,11 @@ public class TimeTaskServiceImpl implements ITimeTaskService {
logger.info("Leave LuckyUserNotice service: result is{}", res);
return res;
}
public void shutdownLuckyUserNotice(){
logger.info("Enter shutdownLuckyUserNotice");
// 关闭定时任务线程
Const.LUCKYUSERNOTICE_EXE.shutdownNow();
}
}
... ...
package com.yoho.activity.queue.thread;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
... ... @@ -10,6 +9,7 @@ import org.springframework.stereotype.Service;
import com.netflix.config.DynamicLongProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.yoho.activity.queue.constant.Const;
import com.yoho.activity.queue.service.ITimeTaskService;
@Service
... ... @@ -25,7 +25,7 @@ public class LuckyUserNoticeThread {
DynamicLongProperty initialDelay = DynamicPropertyFactory.getInstance().getLongProperty("drawline.luckyUserNotice.interval", 120);
//(2)服务启动10后开始执行, 默认每隔2小时执行一次
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
Const.LUCKYUSERNOTICE_EXE.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
... ...