The thread pool implementation strategy for service providers requires creating a thread in the thread pool to execute the service provider’s business logic when the server receives a request.
org.apache.dubbo.common.threadpool.ThreadPool
<dubbo:protocol threadpool="xxx" />
<!-- Default value configuration, used when <dubbo:protocol> does not configure threadpool -->
<dubbo:provider threadpool="xxx" />
org.apache.dubbo.common.threadpool.FixedThreadPool
org.apache.dubbo.common.threadpool.CachedThreadPool
Maven project structure:
src
|-main
|-java
|-com
|-xxx
|-XxxThreadPool.java (implements ThreadPool interface)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.common.threadpool.ThreadPool (plain text file, content: xxx=com.xxx.XxxThreadPool)
XxxThreadPool.java:
package com.xxx;
import org.apache.dubbo.common.threadpool.ThreadPool;
import java.util.concurrent.Executor;
public class XxxThreadPool implements ThreadPool {
public Executor getExecutor() {
// ...
}
}
META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool:
xxx=com.xxx.XxxThreadPool