Simplify code

Motivation:

Code can be simplified

Modification:

Refactor code to remove extra branching

Result:

Cleaner code.
This commit is contained in:
jiachun.fjc 2017-05-03 00:37:09 +08:00 committed by Norman Maurer
parent ed37cf20ef
commit e58095c4f2

View File

@ -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) {