package kr.wisestone.owl.util;
|
|
/**
|
* Created by wisestone on 2018-02-01.
|
*/
|
public class ThreadCounter {
|
private volatile static ThreadCounter uniqueInstance;
|
|
private ThreadCounter() {
|
}
|
|
public static ThreadCounter getInstance() {
|
if (uniqueInstance == null) {
|
synchronized (ThreadCounter.class) {
|
if (uniqueInstance == null) {
|
uniqueInstance = new ThreadCounter();
|
}
|
}
|
}
|
|
return uniqueInstance;
|
}
|
|
private volatile Long count = 0L;
|
|
public synchronized Long getCount() {
|
return count;
|
}
|
|
public synchronized void setCount(Long count) {
|
this.count = count;
|
}
|
|
public synchronized void addCount() {
|
this.count++;
|
}
|
}
|