fix: Add some ERROR logs.

pull/1125/head
yanrongzhen 3 years ago
parent cef25b07f7
commit 6f4b2ceca6

@ -17,7 +17,6 @@
package cn.hippo4j.adapter.web;
import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.common.enums.WebContainerEnum;
import cn.hippo4j.common.model.ThreadPoolBaseInfo;
import cn.hippo4j.common.model.ThreadPoolParameter;
@ -26,14 +25,7 @@ import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.web.context.WebServerApplicationContext;
import org.springframework.boot.web.server.WebServer;
import org.springframework.context.ApplicationContext;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Abstract web thread pool service.

@ -26,6 +26,7 @@ import cn.hippo4j.common.model.ThreadPoolParameterInfo;
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
import cn.hippo4j.common.web.exception.ServiceException;
import cn.hippo4j.config.springboot1x.starter.web.AbstractWebThreadPoolService1x;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer;
import java.util.concurrent.Executor;
@ -33,6 +34,7 @@ import java.util.concurrent.Executor;
/**
* WebThreadPoolHandler compatible with Jetty container for Spring 1.x version.
*/
@Slf4j
public class JettyWebThreadPoolHandler1x extends AbstractWebThreadPoolService1x {
public JettyWebThreadPoolHandler1x() {
@ -44,7 +46,8 @@ public class JettyWebThreadPoolHandler1x extends AbstractWebThreadPoolService1x
try {
return ((JettyEmbeddedServletContainer) getContainer()).getServer().getThreadPool();
} catch (Throwable th) {
throw new ServiceException("Failed to get Jetty thread pool.", th);
log.error("Failed to get Jetty thread pool.", th);
return null;
}
}

@ -48,7 +48,8 @@ public class TomcatWebThreadPoolHandler1x extends AbstractWebThreadPoolService1x
return ((TomcatEmbeddedServletContainer) getContainer())
.getTomcat().getConnector().getProtocolHandler().getExecutor();
} catch (Throwable th) {
throw new ServiceException("Failed to get Tomcat thread pool.", th);
log.error("Failed to get Tomcat thread pool.", th);
return null;
}
}

@ -55,7 +55,8 @@ public class UndertowWebThreadPoolHandler1x extends AbstractWebThreadPoolService
Undertow undertow = (Undertow) ReflectionUtils.getField(field, container);
return undertow.getWorker();
} catch (Throwable th) {
throw new ServiceException("Failed to get Undertow thread pool.", th);
log.error("Failed to get Undertow thread pool.", th);
return null;
}
}

Loading…
Cancel
Save