-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shutdown时间为何设置30s太长了吧 #3
Comments
嗯,已经更改为5s了,原意是为了让AsyncPerfStatsProcessor中的任务能完全执行完毕,根据目前的使用情况来看是有点长了。 |
如果能够配上架构图或者详细点的使用说明图就更好了。我按照使用手册跑起来了,没有看到你输出的内容。 |
指定IncludePackages了么,默认的输出到stdout里了,并且默认只输出count > 0的方法; |
打印日志如下: IncludePackages也配置的有。没有你给的: |
看日志, “RoundRobinProcessor finished”和“BackgroundProcessor finished”个打印了两次,理论上应该是各一次,应该是哪里配置错了; |
项目没有依赖。 |
我刚刚修复了一个bug,是由于代码中尝试对抽象方法和native方法进行注入后导致BackgroundProcessor提前结束循环,进而所输出的'MyPerf4J Performance Statistics'的方法偏少甚至不输出; |
已经尝试在使用中、如有问题反馈! |
好的,感谢反馈! |
AsyncPerfStatsProcessor类 第二个小疑问为何 shutdown hook 没有对 RoundRobinProcessor、BackgroundProcessor 两个线程进行关闭处理呢?谢谢! |
对于第一个问题,是这样的,AsyncPerfStatsProcessor负责处理提交自backgroundExecutor的性能统计数据,而引入ShutdownHook是为了把在当前TimeSlice里的数据进行处理,尽可能的保证数据不丢失,所以才等待了5s的时间,AsyncPerfStatsProcessor. executor设置的5分钟是指当前线程数超过coreSize部分的线程空闲时间达到5分钟后线程池会自动缩容至coreSize。 对于第二个问题,这个我倒是没注意到,不过RoundRobinProcessor和BackgroundProcessor只是在一个TimeSlice结束时才会触发,并且它们的执行时间都非常短(都是内存操作),理论上应该不用手动进行关闭。 PS: |
ThreadPoolExecutor executor = processor.getExecutor();
executor.shutdown();
executor.awaitTermination(30, TimeUnit.SECONDS);
The text was updated successfully, but these errors were encountered: