Refactor not supported exception

pull/1098/head
machen 2 years ago
parent 209856a174
commit 1cc35a13f5

@ -18,7 +18,6 @@
package cn.hippo4j.common.executor.support;
import cn.hippo4j.common.spi.DynamicThreadPoolServiceLoader;
import cn.hippo4j.common.web.exception.NotSupportedException;
import lombok.Getter;
import java.util.Collection;
@ -35,8 +34,6 @@ import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.function.Predicate;
import static cn.hippo4j.common.web.exception.ErrorCodeEnum.SERVICE_ERROR;
/**
* Blocking queue type enum.
*/
@ -145,7 +142,7 @@ public enum BlockingQueueTypeEnum {
* @return a BlockingQueue view of the specified T
*/
<T> BlockingQueue<T> of(Integer capacity) {
throw new NotSupportedException("该队列必须有界", SERVICE_ERROR);
throw new NotSupportedException("该队列必须有界");
}
/**
@ -157,7 +154,7 @@ public enum BlockingQueueTypeEnum {
* @throws NotSupportedException
*/
<T> BlockingQueue<T> of() {
throw new NotSupportedException("该队列不支持有界", SERVICE_ERROR);
throw new NotSupportedException("该队列不支持有界");
}
/**

@ -0,0 +1,20 @@
package cn.hippo4j.common.executor.support;
import cn.hippo4j.common.web.exception.AbstractException;
/**
* This exception is thrown when a context implementation does not support the operation being invoked.
*/
public class NotSupportedException extends AbstractException {
/**
* Constructs a new not supported exception with the specified detail message and
* cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
*/
public NotSupportedException(String message) {
super(message, null, null);
}
}

@ -1,12 +0,0 @@
package cn.hippo4j.common.web.exception;
/**
* This exception is thrown when a context implementation does not support the operation being invoked.
*/
public class NotSupportedException extends AbstractException {
public NotSupportedException(String message, ErrorCode errorCode) {
super(message, null, errorCode);
}
}
Loading…
Cancel
Save