Skip to content

Commit

Permalink
Fix pmd error
Browse files Browse the repository at this point in the history
  • Loading branch information
nkorange committed Aug 5, 2018
1 parent a8ead77 commit ffa921b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
* @author harold
*/
public class BeatReactor {

private ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(r -> {
private ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1, r -> {
Thread thread = new Thread(r);
thread.setDaemon(true);
thread.setName("com.alibaba.nacos.naming.beat.sender");
return thread;
});
;

private long clientBeatInterval = 10 * 1000;

Expand Down

2 comments on commit ffa921b

@javartisan
Copy link
Contributor

@javartisan javartisan commented on ffa921b Aug 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两种方法创建线程应该没什么区别吧?修改的目的是什么,学习下

@nkorange
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javartisan 这两行代码没什么区别,但是两种方式还有有一些区别的,可以参考:https://www.jianshu.com/p/0e228dc30793

Please sign in to comment.