240 |
|
* executor is saturated. |
241 |
|
*/ |
242 |
|
public void testExecute1() { |
243 |
< |
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1)); |
243 |
> |
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1)); |
244 |
|
try { |
245 |
|
|
246 |
|
for(int i = 0; i < 5; ++i){ |
256 |
|
* if executor is saturated. |
257 |
|
*/ |
258 |
|
public void testExecute2() { |
259 |
< |
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1)); |
259 |
> |
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1)); |
260 |
|
try { |
261 |
|
for(int i = 0; i < 5; ++i) { |
262 |
|
p.submit(new SmallCallable()); |
272 |
|
* caller interrupted. |
273 |
|
*/ |
274 |
|
public void testInterruptedSubmit() { |
275 |
< |
final ThreadPoolExecutor p = new ThreadPoolExecutor(1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
275 |
> |
final ThreadPoolExecutor p = new ThreadPoolExecutor(1,1,60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10)); |
276 |
|
Thread t = new Thread(new Runnable() { |
277 |
|
public void run() { |
278 |
|
try { |
308 |
|
* interrupted |
309 |
|
*/ |
310 |
|
public void testSubmitIE() { |
311 |
< |
final ThreadPoolExecutor p = new ThreadPoolExecutor(1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
311 |
> |
final ThreadPoolExecutor p = new ThreadPoolExecutor(1,1,60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10)); |
312 |
|
|
313 |
|
final Callable c = new Callable() { |
314 |
|
public Object call() { |
348 |
|
* throws exception |
349 |
|
*/ |
350 |
|
public void testSubmitEE() { |
351 |
< |
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
351 |
> |
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1,60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10)); |
352 |
|
|
353 |
|
try { |
354 |
|
Callable c = new Callable() { |
764 |
|
l.add(new StringTask()); |
765 |
|
l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING)); |
766 |
|
l.add(new StringTask()); |
767 |
< |
List<Future<String>> result = e.invokeAll(l, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); |
767 |
> |
List<Future<String>> result = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); |
768 |
|
assertEquals(3, result.size()); |
769 |
|
Iterator<Future<String>> it = result.iterator(); |
770 |
|
Future<String> f1 = it.next(); |