You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TimeLimiters use an ExecutorService to which their Callables are submitted. A Future is retained and, when the time limit is reached, the Future is cancelled.
Currently, the AttemptTimeLimiters.fixedTimeLimit method that does not take an ExecutorService creates a new cached thread pool every time it is used. (See the FixedAttemptTimeLimiter constructor.)
Because each call creates a new cached thread pool, none of the threads from any of the thread pools will ever be reused. Each pool will create a single thread, that thread will be used, the thread will remain alive but inactive for sixty seconds then die. At that point the cached thread pool can be garbage collected.
Instead of create a new thread pool each time it is invoked that FixedAttemptTimeLimiter constructor should use the same instance of a cached thread pool every time.
The text was updated successfully, but these errors were encountered:
There is no need for the FixedAttemptTimeLimit that takes no executor
to create a new cached thread pool every time it is invoked. Instead,
all instances can use the same static cached thread pool so threads
are reused.
Fixes#17
The TimeLimiters use an ExecutorService to which their Callables are submitted. A Future is retained and, when the time limit is reached, the Future is cancelled.
Currently, the AttemptTimeLimiters.fixedTimeLimit method that does not take an ExecutorService creates a new cached thread pool every time it is used. (See the FixedAttemptTimeLimiter constructor.)
Because each call creates a new cached thread pool, none of the threads from any of the thread pools will ever be reused. Each pool will create a single thread, that thread will be used, the thread will remain alive but inactive for sixty seconds then die. At that point the cached thread pool can be garbage collected.
Instead of create a new thread pool each time it is invoked that FixedAttemptTimeLimiter constructor should use the same instance of a cached thread pool every time.
The text was updated successfully, but these errors were encountered: