监控适配netty

pull/277/head
shining-stars-lk 3 years ago
parent 4b644453ba
commit 34a48dd9a0

@ -22,6 +22,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
/** /**
@ -66,10 +67,13 @@ public class MonitorNettyServer {
channelFuture.channel().closeFuture().sync(); channelFuture.channel().closeFuture().sync();
} catch (Exception e) { } catch (Exception e) {
log.error("nettyServerInit error",e); log.error("nettyServerInit error",e);
} finally {
bossGroup.shutdownGracefully();
workGroup.shutdownGracefully();
} }
},"nettyServerInit thread").start(); },"nettyServerInit thread").start();
} }
@PreDestroy
public void destroy(){
bossGroup.shutdownGracefully();
workGroup.shutdownGracefully();
}
} }

@ -7,7 +7,7 @@ spring.application.name=dynamic-threadpool-example
spring.dynamic.thread-pool.server-addr=http://localhost:6691 spring.dynamic.thread-pool.server-addr=http://localhost:6691
spring.dynamic.thread-pool.netty-server-port=8899 spring.dynamic.thread-pool.netty-server-port=8899
#spring.dynamic.thread-pool.report-type=netty spring.dynamic.thread-pool.report-type=netty
spring.dynamic.thread-pool.namespace=prescription spring.dynamic.thread-pool.namespace=prescription
spring.dynamic.thread-pool.item-id=dynamic-threadpool-example spring.dynamic.thread-pool.item-id=dynamic-threadpool-example
spring.dynamic.thread-pool.username=admin spring.dynamic.thread-pool.username=admin

Loading…
Cancel
Save