tomcat退出时javaagent无法关闭

问题描述

在 javaagent 中启动一个线程。 但是tomcat退出,javaagent无法关闭。 当应用程序退出时,JVM 不会退出,因为我的代理正在阻止它。

public MyTransformer(Instrumentation ins){
    instrumentation = ins;
    Thread thread = new TransformClassthread(ins);
    thread.setDaemon(true);
    thread.start();
 }

在 TransformClassthread 中运行方法

public void run() {
  while (true){
      try {
          //do something
          Thread.sleep(1000);
      }catch (Exception e){
          e.printstacktrace();
      }
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)