Skip to content

Commit 19a6a1f

Browse files
committed
fix: Add some notes.
1 parent 6f4b2ce commit 19a6a1f

File tree

6 files changed

+65
-4
lines changed

6 files changed

+65
-4
lines changed

hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/DefaultAbstractWebThreadPoolService.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,46 @@
2424

2525
import java.util.concurrent.Executor;
2626

27+
/**
28+
* Default WebThreadPoolService abstract class,
29+
* reuses common capabilities for web container operations.
30+
*/
2731
public abstract class DefaultAbstractWebThreadPoolService extends AbstractWebThreadPoolService {
2832

2933
public DefaultAbstractWebThreadPoolService(IWebThreadPoolHandlerSupport support) {
3034
super(support);
3135
}
3236

37+
/**
38+
* Get the internal abstract method of the web container thread pool,
39+
* to be implemented by subclasses.
40+
* @return
41+
*/
3342
@Override
3443
protected Executor getWebThreadPoolInternal() {
3544
return getWebThreadPoolByServer(getWebServer());
3645
}
3746

47+
/**
48+
* Get port by server.
49+
* @return web port
50+
*/
3851
@Override
3952
public Integer getPort() {
4053
return getWebServer().getPort();
4154
}
4255

4356
/**
44-
* Get web thread pool by server
45-
*
46-
* @param webServer
47-
* @return
57+
* Get the thread pool object of the current web container based on the WebServer.
58+
* @param webServer current Web-Server.
59+
* @return Thread pool executor of the current web container.
4860
*/
4961
protected abstract Executor getWebThreadPoolByServer(WebServer webServer);
5062

63+
/**
64+
* Get current Web Server.
65+
* @return webServer current Web-Server.
66+
*/
5167
public WebServer getWebServer() {
5268
ApplicationContext applicationContext = ApplicationContextHolder.getInstance();
5369
return ((WebServerApplicationContext) applicationContext).getWebServer();

hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/IWebThreadPoolHandlerSupport.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,40 @@
2525

2626
import java.util.concurrent.Executor;
2727

28+
/**
29+
* Support class for WebThreadPoolHandler, providing some common methods.
30+
*/
2831
public interface IWebThreadPoolHandlerSupport {
2932

33+
/**
34+
* Set the Executor to the current class
35+
* so that other methods in the class can function properly.
36+
* @param executor
37+
*/
3038
void setExecutor(Executor executor);
3139

40+
/**
41+
* Retrieve the simple information of the thread pool.
42+
* @return
43+
*/
3244
ThreadPoolBaseInfo simpleInfo();
3345

46+
/**
47+
* Retrieve the parameter of the thread pool.
48+
* @return
49+
*/
3450
ThreadPoolParameter getWebThreadPoolParameter();
3551

52+
/**
53+
* Retrieve the run state of the thread pool.
54+
* @return
55+
*/
3656
ThreadPoolRunStateInfo getWebRunStateInfo();
3757

58+
/**
59+
* Update thread pool parameters.
60+
* @param threadPoolParameterInfo New parameters
61+
*/
3862
void updateWebThreadPool(ThreadPoolParameterInfo threadPoolParameterInfo);
3963

4064
WebContainerEnum getWebContainerType();

hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/jetty/DefaultJettyWebThreadPoolHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ public DefaultJettyWebThreadPoolHandler() {
4646
super(new JettyWebThreadPoolHandlerSupport());
4747
}
4848

49+
/**
50+
* Get the thread pool object of the current web container based on the WebServer.
51+
* @param webServer current Web-Server.
52+
* @return Thread pool executor of the current web container.
53+
*/
4954
@Override
5055
protected Executor getWebThreadPoolByServer(WebServer webServer) {
5156
JettyWebServer jettyWebServer = (JettyWebServer) webServer;

hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/tomcat/DefaultTomcatWebThreadPoolHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public DefaultTomcatWebThreadPoolHandler(AbstractThreadPoolRuntime runtime) {
4848
super(new TomcatWebThreadPoolHandlerSupport(runtime));
4949
}
5050

51+
/**
52+
* Get the thread pool object of the current web container based on the WebServer.
53+
* @param webServer current Web-Server.
54+
* @return Thread pool executor of the current web container.
55+
*/
5156
@Override
5257
protected Executor getWebThreadPoolByServer(WebServer webServer) {
5358
if (cacheFlag.get()) {

hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/undertow/DefaultUndertowWebThreadPoolHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public DefaultUndertowWebThreadPoolHandler() {
4949
super(new UndertowWebThreadPoolHandlerSupport());
5050
}
5151

52+
/**
53+
* Get the thread pool object of the current web container based on the WebServer.
54+
* @param webServer current Web-Server.
55+
* @return Thread pool executor of the current web container.
56+
*/
5257
@Override
5358
protected Executor getWebThreadPoolByServer(WebServer webServer) {
5459
// There is no need to consider reflection performance because the fetch is a singleton.

hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/AbstractWebThreadPoolService1x.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ public AbstractWebThreadPoolService1x(IWebThreadPoolHandlerSupport support) {
3232
super(support);
3333
}
3434

35+
/**
36+
* Get the embedded Servlet container from the Spring application context.
37+
*/
3538
protected EmbeddedServletContainer getContainer() {
3639
return ((EmbeddedWebApplicationContext) ApplicationContextHolder.getInstance()).getEmbeddedServletContainer();
3740
}
3841

42+
/**
43+
* Get the port from web container.
44+
*/
3945
@Override
4046
public Integer getPort() {
4147
return getContainer().getPort();

0 commit comments

Comments
 (0)