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) {
Thread t = newThread(new DefaultRunnableDecorator(r), prefix + nextId.incrementAndGet());
try {
if (t.isDaemon()) {
if (!daemon) {
t.setDaemon(false);
}
} else {
if (daemon) {
t.setDaemon(true);
}
if (t.isDaemon() != daemon) {
t.setDaemon(daemon);
}
if (t.getPriority() != priority) {