Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newExceedCallerRunsPool newExceedCallImmediatelyPool 场景区别 #1

Open
ronanhardiman opened this issue Sep 29, 2016 · 1 comment
Labels

Comments

@ronanhardiman
Copy link

库写的很好,学习了,请教下 newExceedCallerRunsPool newExceedCallImmediatelyPool 的使用场景区别, 看了文档,还没很明白,谢谢。

@ronanhardiman ronanhardiman changed the title newExceedCallerRunsPool newExceedCallImmediatelyPool 场景 newExceedCallerRunsPool newExceedCallImmediatelyPool 场景区别 Sep 29, 2016
@Jacksgong
Copy link
Owner

Jacksgong commented Sep 29, 2016

谢谢。

  • newExceedCallerRunsPool:当运行中的任务达到maximumPoolSize个数,还有任务进入线程池的时候,会立即在调用进入线程池方法的线程执行(execute/submit)。
  • newExceedCallImmediatelyPool:当运行中的任务达到maximumPoolSize个数,还有任务进入线程池的时候,会立即在一个全局的RealExecutors.TEMPORARY_CACHED_THREAD_POOL线程池(该线程池中的线程在闲置5秒后就会直接释放)中执行。

库中的newExceedWaitPool目前在任务高并发进出队列的时候,由于ThreadPoolExecutor#getActiveCount 返回的个数并不一定准确,小概率会出现StackOverflowError的bug,我正在想办法解决这个问题,也欢迎PR。

Jacksgong added a commit that referenced this issue Oct 9, 2016
… can customize the maximum number of threads that can run in the pool, and the amount of time that they wait while they are idle

Refs #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants