178 |
|
/** |
179 |
|
* Creates a thread pool that can schedule commands to run after a |
180 |
|
* given delay, or to execute periodically. |
181 |
< |
* @return a <tt>ScheduledExecutor</tt> that may safely be cast to |
182 |
< |
* an <tt>ExecutorService</tt>. |
181 |
> |
* @return a newly created scheduled thread pool with termination management |
182 |
|
*/ |
183 |
|
public static ScheduledExecutorService newScheduledThreadPool() { |
184 |
|
return newScheduledThreadPool(1); |
189 |
|
* given delay, or to execute periodically. |
190 |
|
* @param corePoolSize the number of threads to keep in the pool, |
191 |
|
* even if they are idle. |
192 |
< |
* @return a <tt>ScheduledExecutor</tt> that may safely be cast to |
194 |
< |
* an <tt>ExecutorService</tt>. |
192 |
> |
* @return a newly created scheduled thread pool with termination management |
193 |
|
*/ |
194 |
|
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize) { |
195 |
|
return new DelegatedScheduledExecutorService |
203 |
|
* even if they are idle. |
204 |
|
* @param threadFactory the factory to use when the executor |
205 |
|
* creates a new thread. |
206 |
< |
* @return a <tt>ScheduledExecutor</tt> that may safely be cast to |
209 |
< |
* an <tt>ExecutorService</tt>. |
206 |
> |
* @return a newly created scheduled thread pool with termination management |
207 |
|
*/ |
208 |
|
public static ScheduledExecutorService newScheduledThreadPool( |
209 |
|
int corePoolSize, ThreadFactory threadFactory) { |