diff --git a/docs/src/.vuepress/sidebar/zh.ts b/docs/src/.vuepress/sidebar/zh.ts index 11d436b0..36d364e6 100644 --- a/docs/src/.vuepress/sidebar/zh.ts +++ b/docs/src/.vuepress/sidebar/zh.ts @@ -68,6 +68,7 @@ export const zhSidebar = sidebar({ children: [ '/v2/jt-808/guide/customization/netty-config.md', '/v2/jt-808/guide/customization/codec-config.md', + '/v2/jt-808/guide/customization/custom-thread-pool.md', '/v2/jt-808/guide/customization/session-config.md', '/v2/jt-808/guide/customization/sub-package-config.md', '/v2/jt-808/guide/customization/request-lifecycle-listener.md', diff --git a/docs/src/v2/jt-808/guide/customization/custom-thread-pool.md b/docs/src/v2/jt-808/guide/customization/custom-thread-pool.md new file mode 100644 index 00000000..15fb6bac --- /dev/null +++ b/docs/src/v2/jt-808/guide/customization/custom-thread-pool.md @@ -0,0 +1,55 @@ +--- +icon: change +--- + +# 业务线程池(v2.3.0-rc.2) + +::: tip + +业务线程池是 中新增的。 + +::: + +## 配置内置业务线程池 + +```yaml +jt808: + # Netty 线程池 + msg-processor: + executor-group: + thread-count: 2 + pool-name: 808-msg-processer + max-pending-tasks: 128 + ## 业务线程池(指令服务器 和 附件服务器共用) + msg-handler: + enabled: true + core-pool-size: 64 + max-pool-size: 128 + keep-alive: 1m + max-pending-tasks: 256 + daemon: true + pool-name: 808-handler +``` + +## 替换内置业务线程池 + +要替换内置的业务线程池,请提供一个 `Jt808ServerSchedulerFactory` 类型的 `Bean`。 + +```java + +@Configuration +public class SomeConfigurationClass { + + @Bean + Jt808ServerSchedulerFactory jt808ServerSchedulerFactory() { + return new Jt808ServerSchedulerFactory() { + @Override + public ExecutorService getMsgHandlerExecutor() { + // 这里返回自定义线程池 + return null; + } + }; + } + +} +``` diff --git a/docs/src/v2/jt-808/guide/index.md b/docs/src/v2/jt-808/guide/index.md index 213fb70f..d46cd465 100644 --- a/docs/src/v2/jt-808/guide/index.md +++ b/docs/src/v2/jt-808/guide/index.md @@ -36,6 +36,7 @@ - 定制化 - [Netty相关](./customization/netty-config.md) - [编码相关](./customization/codec-config.md) + - [业务线程池](./customization/custom-thread-pool.md) - [Session相关](./customization/session-config.md) - [分包相关](./customization/sub-package-config.md) - [请求生存周期监听器](./customization/request-lifecycle-listener.md)