Skip to content

Commit

Permalink
Merge pull request #17 from xuezhongde/v201705021924_pr
Browse files Browse the repository at this point in the history
code simplified
  • Loading branch information
fengjiachun authored May 2, 2017
2 parents bf892a5 + 08f5ec3 commit 8deea13
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,12 @@ public NamedThreadFactory(String prefix, boolean daemon, int priority) {

@Override
public Thread newThread(Runnable r) {
checkNotNull(r, "runnable");
checkNotNull(r, "runnable obj was null.");

String name = prefix + nextId.getAndIncrement();
Thread t = new InternalThread(group, r, name, 0);
try {
if (t.isDaemon()) {
if (!daemon) {
t.setDaemon(false);
}
} else {
if (daemon) {
t.setDaemon(true);
}
}
t.setDaemon(daemon);

if (t.getPriority() != priority) {
t.setPriority(priority);
Expand Down

0 comments on commit 8deea13

Please sign in to comment.