add timmer in ArthasBootstrap

This commit is contained in:
hengyunabc 2020-05-18 01:30:45 +08:00
parent a82e0a9eb4
commit b7c3202246
2 changed files with 13 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Timer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
@ -77,6 +78,8 @@ public class ArthasBootstrap {
private static LoggerContext loggerContext;
private Timer timer = new Timer("arthas-timer", true);
private ArthasBootstrap(Instrumentation instrumentation, String args) throws Throwable {
this.instrumentation = instrumentation;
@ -387,6 +390,10 @@ public class ArthasBootstrap {
return tunnelClient;
}
public Timer getTimer() {
return this.timer;
}
private Logger logger() {
return LoggerFactory.getLogger(this.getClass());
}

View File

@ -11,11 +11,11 @@ import java.util.concurrent.TimeUnit;
import com.alibaba.arthas.deps.org.slf4j.Logger;
import com.alibaba.arthas.deps.org.slf4j.LoggerFactory;
import com.taobao.arthas.core.GlobalOptions;
import com.taobao.arthas.core.server.ArthasBootstrap;
import com.taobao.arthas.core.shell.cli.CliToken;
import com.taobao.arthas.core.shell.handlers.Handler;
import com.taobao.arthas.core.shell.impl.ShellImpl;
import com.taobao.arthas.core.shell.system.Job;
import com.taobao.arthas.core.shell.term.impl.httptelnet.HttpTelnetTermServer;
/**
* 全局的Job Controller不应该存在启停的概念不需要在连接的断开时关闭
@ -24,10 +24,14 @@ import com.taobao.arthas.core.shell.term.impl.httptelnet.HttpTelnetTermServer;
*/
public class GlobalJobControllerImpl extends JobControllerImpl {
private Timer timer = new Timer("arthas-job-timeout", true);
private Timer timer;
private Map<Integer, TimerTask> jobTimeoutTaskMap = new HashMap<Integer, TimerTask>();
private static final Logger logger = LoggerFactory.getLogger(GlobalJobControllerImpl.class);
public GlobalJobControllerImpl() {
timer = ArthasBootstrap.getInstance().getTimer();
}
@Override
public void close(final Handler<Void> completionHandler) {
if (completionHandler != null) {