45 |
|
* ScheduleExecutor methods of a ScheduledThreadPoolExecutor. |
46 |
|
*/ |
47 |
|
private static class DelegatedScheduledExecutorService |
48 |
< |
extends DelegatedExecutorService implements ScheduledExecutor { |
48 |
> |
extends DelegatedExecutorService |
49 |
> |
implements ScheduledExecutorService { |
50 |
|
private final ScheduledExecutor e; |
51 |
< |
DelegatedScheduledExecutorService(ScheduledThreadPoolExecutor executor) { |
51 |
> |
DelegatedScheduledExecutorService(ScheduledExecutorService executor) { |
52 |
|
super(executor); |
53 |
|
e = executor; |
54 |
|
} |
181 |
|
* @return a <tt>ScheduledExecutor</tt> that may safely be cast to |
182 |
|
* an <tt>ExecutorService</tt>. |
183 |
|
*/ |
184 |
< |
public static ScheduledExecutor newScheduledThreadPool() { |
184 |
> |
public static ScheduledExecutorService newScheduledThreadPool() { |
185 |
|
return newScheduledThreadPool(1); |
186 |
|
} |
187 |
|
|
193 |
|
* @return a <tt>ScheduledExecutor</tt> that may safely be cast to |
194 |
|
* an <tt>ExecutorService</tt>. |
195 |
|
*/ |
196 |
< |
public static ScheduledExecutor newScheduledThreadPool(int corePoolSize) { |
196 |
> |
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize) { |
197 |
|
return new DelegatedScheduledExecutorService |
198 |
|
(new ScheduledThreadPoolExecutor(corePoolSize)); |
199 |
|
} |
208 |
|
* @return a <tt>ScheduledExecutor</tt> that may safely be cast to |
209 |
|
* an <tt>ExecutorService</tt>. |
210 |
|
*/ |
211 |
< |
public static ScheduledExecutor newScheduledThreadPool(int corePoolSize, |
212 |
< |
ThreadFactory threadFactory) { |
211 |
> |
public static ScheduledExecutorService newScheduledThreadPool( |
212 |
> |
int corePoolSize, ThreadFactory threadFactory) { |
213 |
|
return new DelegatedScheduledExecutorService |
214 |
|
(new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)); |
215 |
|
} |