From 6d0423d0f7563d93d86da10d610f9c279fa1cf30 Mon Sep 17 00:00:00 2001 From: yanrongzhen Date: Mon, 13 Mar 2023 20:26:03 +0800 Subject: [PATCH] method does not override or implement a method from a supertype --- .../executor/support/BlockingQueueTypeEnum.java | 8 +++++++- .../executor/support/NotSupportedException.java | 17 +++++++++++++++++ .../common/extension/reducer/AllMatch.java | 1 - .../common/extension/reducer/AnyMatch.java | 1 - .../common/extension/reducer/Reducer.java | 6 ++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/BlockingQueueTypeEnum.java b/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/BlockingQueueTypeEnum.java index 2cdeacb0..ae7e6560 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/BlockingQueueTypeEnum.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/BlockingQueueTypeEnum.java @@ -43,6 +43,7 @@ public enum BlockingQueueTypeEnum { * {@link java.util.concurrent.ArrayBlockingQueue} */ ARRAY_BLOCKING_QUEUE(1, "ArrayBlockingQueue") { + @Override BlockingQueue of(Integer capacity) { return new ArrayBlockingQueue<>(capacity); @@ -53,6 +54,7 @@ public enum BlockingQueueTypeEnum { * {@link java.util.concurrent.LinkedBlockingQueue} */ LINKED_BLOCKING_QUEUE(2, "LinkedBlockingQueue") { + @Override BlockingQueue of(Integer capacity) { return new LinkedBlockingQueue<>(capacity); @@ -63,6 +65,7 @@ public enum BlockingQueueTypeEnum { * {@link java.util.concurrent.LinkedBlockingDeque} */ LINKED_BLOCKING_DEQUE(3, "LinkedBlockingDeque") { + @Override BlockingQueue of() { return new LinkedBlockingDeque<>(); @@ -73,6 +76,7 @@ public enum BlockingQueueTypeEnum { * {@link java.util.concurrent.SynchronousQueue} */ SYNCHRONOUS_QUEUE(4, "SynchronousQueue") { + @Override BlockingQueue of() { return new SynchronousQueue<>(); @@ -83,6 +87,7 @@ public enum BlockingQueueTypeEnum { * {@link java.util.concurrent.LinkedTransferQueue} */ LINKED_TRANSFER_QUEUE(5, "LinkedTransferQueue") { + @Override BlockingQueue of() { return new LinkedTransferQueue<>(); @@ -93,6 +98,7 @@ public enum BlockingQueueTypeEnum { * {@link java.util.concurrent.PriorityBlockingQueue} */ PRIORITY_BLOCKING_QUEUE(6, "PriorityBlockingQueue") { + @Override BlockingQueue of(Integer capacity) { return new PriorityBlockingQueue<>(capacity); @@ -103,6 +109,7 @@ public enum BlockingQueueTypeEnum { * {@link ResizableCapacityLinkedBlockingQueue} */ RESIZABLE_LINKED_BLOCKING_QUEUE(9, "ResizableCapacityLinkedBlockingQueue") { + @Override BlockingQueue of(Integer capacity) { return new ResizableCapacityLinkedBlockingQueue<>(capacity); @@ -197,7 +204,6 @@ public enum BlockingQueueTypeEnum { ServiceLoaderRegistry.register(CustomBlockingQueue.class); } - private static BlockingQueue customOrDefaultQueue(Integer capacity, Predicate predicate) { Collection customBlockingQueues = ServiceLoaderRegistry .getSingletonServiceInstances(CustomBlockingQueue.class); diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/NotSupportedException.java b/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/NotSupportedException.java index 9a9e8105..f3996a05 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/NotSupportedException.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/executor/support/NotSupportedException.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package cn.hippo4j.common.executor.support; import cn.hippo4j.common.web.exception.AbstractException; diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AllMatch.java b/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AllMatch.java index 3ad68b74..d4afa519 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AllMatch.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AllMatch.java @@ -37,7 +37,6 @@ public class AllMatch extends Reducer { public AllMatch(@NonNull Predicate predicate) { Objects.requireNonNull(predicate); this.predicate = predicate; - setResult(true); } @Override diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AnyMatch.java b/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AnyMatch.java index dfc00c17..7fa70a8e 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AnyMatch.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/AnyMatch.java @@ -37,7 +37,6 @@ public class AnyMatch extends Reducer { public AnyMatch(@NonNull Predicate predicate) { Objects.requireNonNull(predicate); this.predicate = predicate; - this.setResult(false); } @Override diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/Reducer.java b/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/Reducer.java index 02a0eafc..548d8cd6 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/Reducer.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/extension/reducer/Reducer.java @@ -44,4 +44,10 @@ public abstract class Reducer { public abstract Result reduce(); + public abstract ReduceType reducerType(); + + public String reduceName() { + return this.getClass().getSimpleName(); + } + }