Remove Chinese annotations (#682)

* Fix the UndertowWeb adaptation

* Fix the UndertowWeb adaptation

* Optimize long polling logic

* Optimizing configuration logic

* Formatting unit tests

* Remove Chinese annotations
pull/684/head
lucky 8 2 years ago committed by GitHub
parent d0ad0a8255
commit f74de2b650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -113,30 +113,18 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService {
}
ThreadPoolRunStateInfo runStateInfo = new ThreadPoolRunStateInfo();
org.apache.tomcat.util.threads.ThreadPoolExecutor tomcatThreadPoolExecutor = (org.apache.tomcat.util.threads.ThreadPoolExecutor) executor;
// 核心线程数
int corePoolSize = tomcatThreadPoolExecutor.getCorePoolSize();
// 最大线程数
int maximumPoolSize = tomcatThreadPoolExecutor.getMaximumPoolSize();
// 线程池当前线程数 (有锁)
int poolSize = tomcatThreadPoolExecutor.getPoolSize();
// 活跃线程数 (有锁)
int activeCount = tomcatThreadPoolExecutor.getActiveCount();
// 同时进入池中的最大线程数 (有锁)
int largestPoolSize = tomcatThreadPoolExecutor.getLargestPoolSize();
// 线程池中执行任务总数量 (有锁)
long completedTaskCount = tomcatThreadPoolExecutor.getCompletedTaskCount();
// 当前负载
String currentLoad = CalculateUtil.divide(activeCount, maximumPoolSize) + "";
// 峰值负载
String peakLoad = CalculateUtil.divide(largestPoolSize, maximumPoolSize) + "";
BlockingQueue<Runnable> queue = tomcatThreadPoolExecutor.getQueue();
// 队列元素个数
int queueSize = queue.size();
// 队列类型
String queueType = queue.getClass().getSimpleName();
// 队列剩余容量
int remainingCapacity = queue.remainingCapacity();
// 队列容量
int queueCapacity = queueSize + remainingCapacity;
runStateInfo.setCoreSize(corePoolSize);
runStateInfo.setPoolSize(poolSize);

@ -103,27 +103,20 @@ public class UndertowWebThreadPoolHandler extends AbstractWebThreadPoolService {
Field field = ReflectionUtils.findField(XnioWorker.class, "taskPool");
ReflectionUtils.makeAccessible(field);
Object fieldObject = ReflectionUtils.getField(field, xnioWorker);
// 核心线程数
Method getCorePoolSize = ReflectionUtils.findMethod(fieldObject.getClass(), "getCorePoolSize");
ReflectionUtils.makeAccessible(getCorePoolSize);
int corePoolSize = (int) ReflectionUtils.invokeMethod(getCorePoolSize, fieldObject);
// 最大线程数
Method getMaximumPoolSize = ReflectionUtils.findMethod(fieldObject.getClass(), "getMaximumPoolSize");
ReflectionUtils.makeAccessible(getMaximumPoolSize);
int maximumPoolSize = (int) ReflectionUtils.invokeMethod(getMaximumPoolSize, fieldObject);
// 线程池当前线程数 (有锁)
Method getPoolSize = ReflectionUtils.findMethod(fieldObject.getClass(), "getPoolSize");
ReflectionUtils.makeAccessible(getPoolSize);
int poolSize = (int) ReflectionUtils.invokeMethod(getPoolSize, fieldObject);
// 活跃线程数 (有锁)
Method getActiveCount = ReflectionUtils.findMethod(fieldObject.getClass(), "getActiveCount");
ReflectionUtils.makeAccessible(getActiveCount);
int activeCount = (int) ReflectionUtils.invokeMethod(getActiveCount, fieldObject);
activeCount = Math.max(activeCount, 0);
// 当前负载
String currentLoad = CalculateUtil.divide(activeCount, maximumPoolSize) + "";
// 峰值负载
// 没有峰值记录,直接使用当前数据
String peakLoad = CalculateUtil.divide(activeCount, maximumPoolSize) + "";
stateInfo.setCoreSize(corePoolSize);
stateInfo.setPoolSize(poolSize);

Loading…
Cancel
Save