| 1234567891011121314151617181920212223 |
- package com.kingdee.eas.custom.beisen.synchronouspos.handler;
- import java.util.concurrent.atomic.AtomicInteger;
- public class ExecutorCountUtil {
- private final AtomicInteger count = new AtomicInteger(0);
- public int get() {
- return count.get(); // 原子读取
- }
- private static ExecutorCountUtil examples = new ExecutorCountUtil();
- public void countPlusPlus() {
- count.incrementAndGet();
- }
- public void countLessLess() {
- count.decrementAndGet();
- }
- public static ExecutorCountUtil getExamples() {
- return examples;
- }
- private ExecutorCountUtil() {
- }
- }
|