|
2 | 2 |
|
3 | 3 | module Concurrent |
4 | 4 |
|
5 | | - if defined? java.util |
| 5 | + if RUBY_PLATFORM == 'java' |
6 | 6 | require 'concurrent/java_cached_thread_pool' |
7 | 7 | # @!macro [attach] cached_thread_pool |
8 | 8 | # A thread pool that dynamically grows and shrinks to fit the current workload. |
9 | 9 | # New threads are created as needed, existing threads are reused, and threads |
10 | 10 | # that remain idle for too long are killed and removed from the pool. These |
11 | 11 | # pools are particularly suited to applications that perform a high volume of |
12 | 12 | # short-lived tasks. |
13 | | - # |
| 13 | + # |
14 | 14 | # On creation a +CachedThreadPool+ has zero running threads. New threads are |
15 | 15 | # created on the pool as new operations are +#post+. The size of the pool |
16 | 16 | # will grow until +#max_length+ threads are in the pool or until the number |
17 | 17 | # of threads exceeds the number of running and pending operations. When a new |
18 | 18 | # operation is post to the pool the first available idle thread will be tasked |
19 | 19 | # with the new operation. |
20 | | - # |
| 20 | + # |
21 | 21 | # Should a thread crash for any reason the thread will immediately be removed |
22 | 22 | # from the pool. Similarly, threads which remain idle for an extended period |
23 | 23 | # of time will be killed and reclaimed. Thus these thread pools are very |
24 | 24 | # efficient at reclaiming unused resources. |
25 | | - # |
| 25 | + # |
26 | 26 | # The API and behavior of this class are based on Java's +CachedThreadPool+ |
27 | 27 | # |
28 | 28 | # @note When running on the JVM (JRuby) this class will inherit from +JavaCachedThreadPool+. |
29 | 29 | # On all other platforms it will inherit from +RubyCachedThreadPool+. |
30 | 30 | # |
31 | 31 | # @see Concurrent::RubyCachedThreadPool |
32 | 32 | # @see Concurrent::JavaCachedThreadPool |
33 | | - # |
| 33 | + # |
34 | 34 | # @see http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html |
35 | 35 | # @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html |
36 | 36 | # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html |
|
0 commit comments