Skip to content

adrian-tarau/threadpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thread Pool

A thread pool implementation in Java which tried to overcome one of the major shortcoming (in the author's opinion): reusing idle threads. There is actually a long-standing JDK enhancement about this issue.

The use case for this feature is the following: when a process requires to have many thread pools, each with a significant number of maximum (core) threads, we end up having (many) hundreds of threads laying around which will consume resources (memory).

Every task scheduled with the pool in the JDK implementation ends up creating a thread even if there are idle threads lying around. These threads will not be reclaimed until the timeout for core threads is reached (if enabled).

In addition to this specific (but important) enhancement, the thread pool aims to provide various feature to help writing multithread applications easier:

  • TODO

Various interfaces are available to schedule task:

  • DelayedTask can be executed and provides the delay to be executed once
  • ScheduledTask can be executed and provides the initial delay and the interval/delay to be executed periodically
  • SingletonTask can be scheduled and only one instance matching a key will be kept in the queue

About

A ThreadPoolExecutor which reuses idle threads

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages