753 |
|
final int count = 5; |
754 |
|
final AtomicInteger ran = new AtomicInteger(0); |
755 |
|
final ThreadPoolExecutor p = |
756 |
< |
new CustomTPE(poolSize, poolSize, LONG_DELAY_MS, MILLISECONDS, |
756 |
> |
new CustomTPE(poolSize, poolSize, |
757 |
> |
LONG_DELAY_MS, MILLISECONDS, |
758 |
|
new ArrayBlockingQueue<Runnable>(10)); |
759 |
|
CountDownLatch threadsStarted = new CountDownLatch(poolSize); |
760 |
|
Runnable waiter = new CheckedRunnable() { public void realRun() { |
1323 |
|
*/ |
1324 |
|
public void testCorePoolSizeIllegalArgumentException() { |
1325 |
|
final ThreadPoolExecutor p = |
1326 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
1327 |
< |
try { |
1328 |
< |
p.setCorePoolSize(-1); |
1329 |
< |
shouldThrow(); |
1330 |
< |
} catch (IllegalArgumentException success) { |
1331 |
< |
} finally { |
1332 |
< |
try { p.shutdown(); } catch (SecurityException ok) { return; } |
1326 |
> |
new CustomTPE(1, 2, |
1327 |
> |
LONG_DELAY_MS, MILLISECONDS, |
1328 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
1329 |
> |
try (PoolCleaner cleaner = cleaner(p)) { |
1330 |
> |
try { |
1331 |
> |
p.setCorePoolSize(-1); |
1332 |
> |
shouldThrow(); |
1333 |
> |
} catch (IllegalArgumentException success) {} |
1334 |
|
} |
1333 |
– |
joinPool(p); |
1335 |
|
} |
1336 |
|
|
1337 |
|
/** |
1340 |
|
*/ |
1341 |
|
public void testMaximumPoolSizeIllegalArgumentException() { |
1342 |
|
final ThreadPoolExecutor p = |
1343 |
< |
new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
1343 |
> |
new CustomTPE(2, 3, |
1344 |
> |
LONG_DELAY_MS, MILLISECONDS, |
1345 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
1346 |
|
try { |
1347 |
|
p.setMaximumPoolSize(1); |
1348 |
|
shouldThrow(); |
1359 |
|
*/ |
1360 |
|
public void testMaximumPoolSizeIllegalArgumentException2() { |
1361 |
|
final ThreadPoolExecutor p = |
1362 |
< |
new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
1362 |
> |
new CustomTPE(2, 3, |
1363 |
> |
LONG_DELAY_MS, |
1364 |
> |
MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
1365 |
|
try { |
1366 |
|
p.setMaximumPoolSize(-1); |
1367 |
|
shouldThrow(); |
1378 |
|
*/ |
1379 |
|
public void testKeepAliveTimeIllegalArgumentException() { |
1380 |
|
final ThreadPoolExecutor p = |
1381 |
< |
new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
1381 |
> |
new CustomTPE(2, 3, |
1382 |
> |
LONG_DELAY_MS, MILLISECONDS, |
1383 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
1384 |
|
|
1385 |
|
try { |
1386 |
|
p.setKeepAliveTime(-1,MILLISECONDS); |