aofeng / threadpool4j Goto Github PK
View Code? Open in Web Editor NEW轻量级多线程池。1)支持异步任务分派至不同的线程池执行;2)支持并行执行多个异步任务;3)支持需要返回结果和不需要返回结果的异步任务。
License: Apache License 2.0
轻量级多线程池。1)支持异步任务分派至不同的线程池执行;2)支持并行执行多个异步任务;3)支持需要返回结果和不需要返回结果的异步任务。
License: Apache License 2.0
使用ant编译的jar包,在threadPoolManager.init()的时候报错NullPointerException: Attempt to invoke interface method 'org.w3c.dom.Element org.w3c.dom.Document.getDocumentElement(),还有请问一下,在Android项目中,配置文件应该放在哪里呢,谢谢
比如 先有1万个任务要多线程处理,互不影响。但是我调用后执行过程中出错:
name:threadpool4j-threadstack, id:16, status:RUNNABLE, priority:5
java.lang.Thread.dumpThreads(Native Method)
java.lang.Thread.getAllStackTraces(Thread.java:1610)
cn.aofeng.threadpool4j.job.ThreadStackJob.execute(ThreadStackJob.java:26)
cn.aofeng.threadpool4j.job.AbstractJob.run(AbstractJob.java:34)
java.lang.Thread.run(Thread.java:748)
自定义线程名称 不是线程池名称
ThreadPoolImpl.destroy调用的是ThreadPoolExecutor.shutdown方法,该方法会把线程池状态设置为SHUTDOWN,不会接收新任务,并中断线程池里空闲的线程(中断信号并不代表线程会停止,需要线程监听中断信号)。但不会阻塞等待线程池队列里的任务执行完成,这会导致队列中的任务丢弃。可以参考Spring的ThreadPoolTaskExecutor.shutdown方法,在ThreadPoolExecutor.shutdown后,执行ThreadPoolExecutor.awaitTermination等待队列中的任务完成后才停止应用。
建议把 初始化线程池的工作放到ThreadPoolManager里,目前的设计,用户完全可以绕过ThreadPoolManager ,而初始化多个ThreadPool。
误报
import cn.aofeng.common4j.ILifeCycle; 这个包好像没有啊,另外springboot项目怎么使用呢
您好,在Android项目中导入源码里面的5个jar包并依赖,但是初始化的时候找不到ThreadPoolManager这个类,还有请问一个在Android项目中,配置文件放那里呢?谢谢
why not add this project to maven repository
如题
配置xml文件时,说明为:“在应用的CLASSPATH的任意路径(如:应用的classes目录)下新建一个threadpool4j.xml的配置文件,其内容为”
这里写明了在Classpath中进行配置,但是我的是普通的执行项目,没有这个目录,于是就按照你源码上的放在conf/biz下面,报错Exception in thread "main" java.lang.IllegalArgumentException: thread pool default not exists,然后放在工程目录下也是这样,放在src目录下还是这样,不知道怎么解决,请指教下
建议内置部分策略例如:等待、丢弃、异常 等,并暴露接口。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.