Commit 9df86812 authored by jim's avatar jim

thread pool

parent 2f19284b
package com.edgec.browserbackend.browser.task;
import com.edgec.browserbackend.account.utils.AccountServicePool;
import com.edgec.browserbackend.common.utils.ThreadPoolUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy;
import java.util.concurrent.TimeUnit;
@Component
public class TerminateBean {
private static final Logger log = LoggerFactory.getLogger(TerminateBean.class);
@PreDestroy
public void onDestroy() throws Exception {
AccountServicePool.taskPool.shutdown();
ThreadPoolUtils.buyIpTasksPool.shutdown();
ThreadPoolUtils.queryIpHealth.shutdown();
ThreadPoolUtils.queryIpTasksPool.shutdown();
AccountServicePool.taskPool.awaitTermination(5, TimeUnit.MINUTES);
ThreadPoolUtils.buyIpTasksPool.awaitTermination(5, TimeUnit.MINUTES);
ThreadPoolUtils.queryIpHealth.awaitTermination(5, TimeUnit.MINUTES);
ThreadPoolUtils.queryIpTasksPool.awaitTermination(5, TimeUnit.MINUTES);
log.warn("threadpool is destroyed!!");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment