Simplify code
Motivation: Code can be simplified Modification: Refactor code to remove extra branching Result: Cleaner code.
This commit is contained in:
parent
ed37cf20ef
commit
e58095c4f2
@ -107,14 +107,8 @@ public class DefaultThreadFactory implements ThreadFactory {
|
|||||||
public Thread newThread(Runnable r) {
|
public Thread newThread(Runnable r) {
|
||||||
Thread t = newThread(new DefaultRunnableDecorator(r), prefix + nextId.incrementAndGet());
|
Thread t = newThread(new DefaultRunnableDecorator(r), prefix + nextId.incrementAndGet());
|
||||||
try {
|
try {
|
||||||
if (t.isDaemon()) {
|
if (t.isDaemon() != daemon) {
|
||||||
if (!daemon) {
|
t.setDaemon(daemon);
|
||||||
t.setDaemon(false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (daemon) {
|
|
||||||
t.setDaemon(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.getPriority() != priority) {
|
if (t.getPriority() != priority) {
|
||||||
|
Loading…
Reference in New Issue
Block a user