140 |
|
} |
141 |
|
|
142 |
|
/** |
143 |
< |
* A new newFixedThreadPool with null ThreadFactory throws NPE |
143 |
> |
* A new newFixedThreadPool with null ThreadFactory throws |
144 |
> |
* NullPointerException |
145 |
|
*/ |
146 |
|
public void testNewFixedThreadPool3() { |
147 |
|
try { |
151 |
|
} |
152 |
|
|
153 |
|
/** |
154 |
< |
* A new newFixedThreadPool with 0 threads throws IAE |
154 |
> |
* A new newFixedThreadPool with 0 threads throws IllegalArgumentException |
155 |
|
*/ |
156 |
|
public void testNewFixedThreadPool4() { |
157 |
|
try { |
282 |
|
delay(LONG_DELAY_MS); |
283 |
|
}}; |
284 |
|
|
285 |
< |
List<Thread> threads = new ArrayList<Thread>(); |
285 |
> |
List<Thread> threads = new ArrayList<>(); |
286 |
|
for (final ExecutorService executor : executors) { |
287 |
|
threads.add(newStartedThread(new CheckedRunnable() { |
288 |
|
public void realRun() { |
307 |
|
public void realRun() { |
308 |
|
try { |
309 |
|
Thread current = Thread.currentThread(); |
310 |
< |
assertTrue(!current.isDaemon()); |
310 |
> |
assertFalse(current.isDaemon()); |
311 |
|
assertTrue(current.getPriority() <= Thread.NORM_PRIORITY); |
311 |
– |
ThreadGroup g = current.getThreadGroup(); |
312 |
|
SecurityManager s = System.getSecurityManager(); |
313 |
< |
if (s != null) |
314 |
< |
assertTrue(g == s.getThreadGroup()); |
315 |
< |
else |
316 |
< |
assertTrue(g == egroup); |
317 |
< |
String name = current.getName(); |
318 |
< |
assertTrue(name.endsWith("thread-1")); |
313 |
> |
assertSame(current.getThreadGroup(), |
314 |
> |
(s == null) ? egroup : s.getThreadGroup()); |
315 |
> |
assertTrue(current.getName().endsWith("thread-1")); |
316 |
|
} catch (SecurityException ok) { |
317 |
|
// Also pass if not allowed to change setting |
318 |
|
} |
340 |
|
Runnable r = new CheckedRunnable() { |
341 |
|
public void realRun() { |
342 |
|
Thread current = Thread.currentThread(); |
343 |
< |
assertTrue(!current.isDaemon()); |
343 |
> |
assertFalse(current.isDaemon()); |
344 |
|
assertTrue(current.getPriority() <= Thread.NORM_PRIORITY); |
348 |
– |
ThreadGroup g = current.getThreadGroup(); |
345 |
|
SecurityManager s = System.getSecurityManager(); |
346 |
< |
if (s != null) |
347 |
< |
assertTrue(g == s.getThreadGroup()); |
348 |
< |
else |
353 |
< |
assertTrue(g == egroup); |
354 |
< |
String name = current.getName(); |
355 |
< |
assertTrue(name.endsWith("thread-1")); |
346 |
> |
assertSame(current.getThreadGroup(), |
347 |
> |
(s == null) ? egroup : s.getThreadGroup()); |
348 |
> |
assertTrue(current.getName().endsWith("thread-1")); |
349 |
|
assertSame(thisccl, current.getContextClassLoader()); |
350 |
|
assertEquals(thisacc, AccessController.getContext()); |
351 |
|
done.countDown(); |