mxinyi1212 最近的时间轴更新
mxinyi1212

mxinyi1212

V2EX 第 599091 号会员,加入于 2022-10-26 16:14:16 +08:00
mxinyi1212 最近回复了
2022-11-15 10:33:45 +08:00
回复了 gzk329 创建的主题 程序员 Springboot 中 想要重启服务 该怎么写?
之前这么用过

public void restart(){
ExecutorService threadPool = new ThreadPoolExecutor(1,1,0, TimeUnit.SECONDS,new ArrayBlockingQueue<>( 1 ),new ThreadPoolExecutor.DiscardOldestPolicy ());
threadPool.execute (()->{
context.close ();
//do xxxx
}
context = SpringApplication.run ( Application.class,args );
} );
threadPool.shutdown ();

}
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4033 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 10:19 · PVG 18:19 · LAX 03:19 · JFK 06:19
Developed with CodeLauncher
♥ Do have faith in what you're doing.