Skip to content

forezp/matrix-threadpool

Repository files navigation

matrix-eventbus

License Maven Central

这个项目干嘛的?

线程池创建和管理的工具类

怎么用

添加依赖:


<dependency>
  <groupId>io.github.forezp</groupId>
  <artifactId>matrix-threadpool-starter</artifactId>
  <version>1.2</version>
</dependency>

添加配置(非必须)

  • threadpool.core.pool.size
  • threadpool.maximum.pool.size
  • threadpool.keep.alive.time
  • threadpool.allow.core.thread.timeout
  • threadpool.queue
  • threadpool.queue.capacity
  • threadpool.rejected.policy

具体怎么配见ThreadConstant类。

使用

@Autowired
ThreadPoolFactory threadPoolFactory;

ThreadPoolExecutor threadPoolExecutor=threadPoolFactory.createDefaultPoolExecutor();

ThreadPoolExecutor threadPoolExecutor=threadPoolFactory.createThreadPoolExecutor("forezp");


ThreadParameter threadParameter =new ThreadParameter();
threadParameter.setThreadPoolCorePoolSize(12);
threadParameter.setThreadPoolKeepAliveTime(600000);
...
ThreadPoolExecutor threadPoolExecutor=threadPoolFactory.createThreadPoolExecutor("forezp",threadParameter);


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages