diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/EphemeralJobQueue.java b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/EphemeralJobQueue.java index 42b16a54cb..acb30356aa 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/EphemeralJobQueue.java +++ b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/EphemeralJobQueue.java @@ -33,12 +33,11 @@ public class EphemeralJobQueue { - protected static final Logger LOG = Log.logger(EphemeralJobQueue.class); + private static final Logger LOG = Log.logger(EphemeralJobQueue.class); - public static final int CAPACITY = 2000; + private static final int CAPACITY = 2000; - private final BlockingQueue> pendingQueue = - new ArrayBlockingQueue<>(CAPACITY); + private final BlockingQueue> pendingQueue; private AtomicReference state; @@ -52,6 +51,7 @@ private enum State { public EphemeralJobQueue(HugeGraph graph) { this.state = new AtomicReference<>(State.INIT); this.graph = graph; + this.pendingQueue = new ArrayBlockingQueue<>(CAPACITY); } public void add(EphemeralJob job) { @@ -103,9 +103,9 @@ public static class BatchEphemeralJob extends EphemeralJob { private static final int PAGE_SIZE = 100; private static final String BATCH_EPHEMERAL_JOB = "batch-ephemeral-job"; - public static final int MAX_CONSUME_COUNT = EphemeralJobQueue.CAPACITY / 2; + private static final int MAX_CONSUME_COUNT = EphemeralJobQueue.CAPACITY / 2; - WeakReference queueWeakReference; + private WeakReference queueWeakReference; public BatchEphemeralJob(EphemeralJobQueue queue) { this.queueWeakReference = new WeakReference<>(queue); @@ -136,7 +136,7 @@ public Object execute() throws Exception { } if (queue.isEmpty() || consumeCount > MAX_CONSUME_COUNT || - interruptedException != null) { + interruptedException != null) { queue.consumeComplete(); stop = true; if (!queue.isEmpty()) { @@ -216,6 +216,6 @@ public Object call() throws Exception { } public interface Reduce { - long reduce(long t1, T t2); + long reduce(T t1, T t2); } } diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java index c25076f8f2..39bc6f0421 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java +++ b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java @@ -1711,6 +1711,7 @@ private static Query parent(Collection queries) { } } } + public static class RemoveLeftIndexJob extends EphemeralJob implements EphemeralJobQueue.Reduce { @@ -1961,7 +1962,7 @@ private HugeElement newestElement(HugeElement element) { } @Override - public long reduce(long t1, Long t2) { + public long reduce(Long t1, Long t2) { return t1 + t2; } }