method does not override or implement a method from a supertype

pull/1102/head
yanrongzhen 3 years ago
parent 5f197547e6
commit 6d0423d0f7

@ -43,6 +43,7 @@ public enum BlockingQueueTypeEnum {
* {@link java.util.concurrent.ArrayBlockingQueue} * {@link java.util.concurrent.ArrayBlockingQueue}
*/ */
ARRAY_BLOCKING_QUEUE(1, "ArrayBlockingQueue") { ARRAY_BLOCKING_QUEUE(1, "ArrayBlockingQueue") {
@Override @Override
<T> BlockingQueue<T> of(Integer capacity) { <T> BlockingQueue<T> of(Integer capacity) {
return new ArrayBlockingQueue<>(capacity); return new ArrayBlockingQueue<>(capacity);
@ -53,6 +54,7 @@ public enum BlockingQueueTypeEnum {
* {@link java.util.concurrent.LinkedBlockingQueue} * {@link java.util.concurrent.LinkedBlockingQueue}
*/ */
LINKED_BLOCKING_QUEUE(2, "LinkedBlockingQueue") { LINKED_BLOCKING_QUEUE(2, "LinkedBlockingQueue") {
@Override @Override
<T> BlockingQueue<T> of(Integer capacity) { <T> BlockingQueue<T> of(Integer capacity) {
return new LinkedBlockingQueue<>(capacity); return new LinkedBlockingQueue<>(capacity);
@ -63,6 +65,7 @@ public enum BlockingQueueTypeEnum {
* {@link java.util.concurrent.LinkedBlockingDeque} * {@link java.util.concurrent.LinkedBlockingDeque}
*/ */
LINKED_BLOCKING_DEQUE(3, "LinkedBlockingDeque") { LINKED_BLOCKING_DEQUE(3, "LinkedBlockingDeque") {
@Override @Override
<T> BlockingQueue<T> of() { <T> BlockingQueue<T> of() {
return new LinkedBlockingDeque<>(); return new LinkedBlockingDeque<>();
@ -73,6 +76,7 @@ public enum BlockingQueueTypeEnum {
* {@link java.util.concurrent.SynchronousQueue} * {@link java.util.concurrent.SynchronousQueue}
*/ */
SYNCHRONOUS_QUEUE(4, "SynchronousQueue") { SYNCHRONOUS_QUEUE(4, "SynchronousQueue") {
@Override @Override
<T> BlockingQueue<T> of() { <T> BlockingQueue<T> of() {
return new SynchronousQueue<>(); return new SynchronousQueue<>();
@ -83,6 +87,7 @@ public enum BlockingQueueTypeEnum {
* {@link java.util.concurrent.LinkedTransferQueue} * {@link java.util.concurrent.LinkedTransferQueue}
*/ */
LINKED_TRANSFER_QUEUE(5, "LinkedTransferQueue") { LINKED_TRANSFER_QUEUE(5, "LinkedTransferQueue") {
@Override @Override
<T> BlockingQueue<T> of() { <T> BlockingQueue<T> of() {
return new LinkedTransferQueue<>(); return new LinkedTransferQueue<>();
@ -93,6 +98,7 @@ public enum BlockingQueueTypeEnum {
* {@link java.util.concurrent.PriorityBlockingQueue} * {@link java.util.concurrent.PriorityBlockingQueue}
*/ */
PRIORITY_BLOCKING_QUEUE(6, "PriorityBlockingQueue") { PRIORITY_BLOCKING_QUEUE(6, "PriorityBlockingQueue") {
@Override @Override
<T> BlockingQueue<T> of(Integer capacity) { <T> BlockingQueue<T> of(Integer capacity) {
return new PriorityBlockingQueue<>(capacity); return new PriorityBlockingQueue<>(capacity);
@ -103,6 +109,7 @@ public enum BlockingQueueTypeEnum {
* {@link ResizableCapacityLinkedBlockingQueue} * {@link ResizableCapacityLinkedBlockingQueue}
*/ */
RESIZABLE_LINKED_BLOCKING_QUEUE(9, "ResizableCapacityLinkedBlockingQueue") { RESIZABLE_LINKED_BLOCKING_QUEUE(9, "ResizableCapacityLinkedBlockingQueue") {
@Override @Override
<T> BlockingQueue<T> of(Integer capacity) { <T> BlockingQueue<T> of(Integer capacity) {
return new ResizableCapacityLinkedBlockingQueue<>(capacity); return new ResizableCapacityLinkedBlockingQueue<>(capacity);
@ -197,7 +204,6 @@ public enum BlockingQueueTypeEnum {
ServiceLoaderRegistry.register(CustomBlockingQueue.class); ServiceLoaderRegistry.register(CustomBlockingQueue.class);
} }
private static <T> BlockingQueue<T> customOrDefaultQueue(Integer capacity, Predicate<CustomBlockingQueue> predicate) { private static <T> BlockingQueue<T> customOrDefaultQueue(Integer capacity, Predicate<CustomBlockingQueue> predicate) {
Collection<CustomBlockingQueue> customBlockingQueues = ServiceLoaderRegistry Collection<CustomBlockingQueue> customBlockingQueues = ServiceLoaderRegistry
.getSingletonServiceInstances(CustomBlockingQueue.class); .getSingletonServiceInstances(CustomBlockingQueue.class);

@ -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; package cn.hippo4j.common.executor.support;
import cn.hippo4j.common.web.exception.AbstractException; import cn.hippo4j.common.web.exception.AbstractException;

@ -37,7 +37,6 @@ public class AllMatch<Element> extends Reducer<Element, Boolean> {
public AllMatch(@NonNull Predicate<Element> predicate) { public AllMatch(@NonNull Predicate<Element> predicate) {
Objects.requireNonNull(predicate); Objects.requireNonNull(predicate);
this.predicate = predicate; this.predicate = predicate;
setResult(true);
} }
@Override @Override

@ -37,7 +37,6 @@ public class AnyMatch<Element> extends Reducer<Element, Boolean> {
public AnyMatch(@NonNull Predicate<Element> predicate) { public AnyMatch(@NonNull Predicate<Element> predicate) {
Objects.requireNonNull(predicate); Objects.requireNonNull(predicate);
this.predicate = predicate; this.predicate = predicate;
this.setResult(false);
} }
@Override @Override

@ -44,4 +44,10 @@ public abstract class Reducer<Element, Result> {
public abstract Result reduce(); public abstract Result reduce();
public abstract ReduceType reducerType();
public String reduceName() {
return this.getClass().getSimpleName();
}
} }

Loading…
Cancel
Save