moved daemon thread examples from core-java-concurrency-advanced to core-java-concurrency-advanced-2
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
- [CyclicBarrier in Java](https://www.baeldung.com/java-cyclic-barrier)
|
||||
- [Guide to the Volatile Keyword in Java](https://www.baeldung.com/java-volatile)
|
||||
|
||||
- [Daemon Threads in Java](https://www.baeldung.com/java-daemon-thread)
|
||||
- [Priority-based Job Scheduling in Java](https://www.baeldung.com/java-priority-job-schedule)
|
||||
- [Brief Introduction to Java Thread.yield()](https://www.baeldung.com/java-thread-yield)
|
||||
- [Print Even and Odd Numbers Using 2 Threads](https://www.baeldung.com/java-even-odd-numbers-with-2-threads)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.baeldung.concurrent.daemon;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DaemonThreadUnitTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void whenCallIsDaemon_thenCorrect() {
|
||||
NewThread daemonThread = new NewThread();
|
||||
NewThread userThread = new NewThread();
|
||||
daemonThread.setDaemon(true);
|
||||
daemonThread.start();
|
||||
userThread.start();
|
||||
|
||||
assertTrue(daemonThread.isDaemon());
|
||||
assertFalse(userThread.isDaemon());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalThreadStateException.class)
|
||||
@Ignore
|
||||
public void givenUserThread_whenSetDaemonWhileRunning_thenIllegalThreadStateException() {
|
||||
NewThread daemonThread = new NewThread();
|
||||
daemonThread.start();
|
||||
daemonThread.setDaemon(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user