mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-10 06:55:32 +00:00
Simplify rejected execution exception
This exception type has several unnecessary constructor overrides so this commit removes them. Relates #27664
This commit is contained in:
parent
1be286c592
commit
eb574425b7
@ -246,13 +246,16 @@ public class EsExecutors {
|
|||||||
* waiting if necessary for space to become available.
|
* waiting if necessary for space to become available.
|
||||||
*/
|
*/
|
||||||
static class ForceQueuePolicy implements XRejectedExecutionHandler {
|
static class ForceQueuePolicy implements XRejectedExecutionHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
||||||
try {
|
try {
|
||||||
|
// force queue policy should only be used with a scaling queue
|
||||||
|
assert executor.getQueue() instanceof ExecutorScalingQueue;
|
||||||
executor.getQueue().put(r);
|
executor.getQueue().put(r);
|
||||||
} catch (InterruptedException e) {
|
} catch (final InterruptedException e) {
|
||||||
//should never happen since we never wait
|
// a scaling queue never blocks so a put to it can never be interrupted
|
||||||
throw new EsRejectedExecutionException(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,6 +263,7 @@ public class EsExecutors {
|
|||||||
public long rejected() {
|
public long rejected() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,29 +27,20 @@ import org.elasticsearch.rest.RestStatus;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class EsRejectedExecutionException extends ElasticsearchException {
|
public class EsRejectedExecutionException extends ElasticsearchException {
|
||||||
|
|
||||||
private final boolean isExecutorShutdown;
|
private final boolean isExecutorShutdown;
|
||||||
|
|
||||||
public EsRejectedExecutionException(String message, boolean isExecutorShutdown, Object... args) {
|
public EsRejectedExecutionException(String message, boolean isExecutorShutdown) {
|
||||||
super(message, args);
|
super(message, isExecutorShutdown);
|
||||||
this.isExecutorShutdown = isExecutorShutdown;
|
this.isExecutorShutdown = isExecutorShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EsRejectedExecutionException(String message, Object... args) {
|
public EsRejectedExecutionException(String message) {
|
||||||
this(message, false, args);
|
this(message, false);
|
||||||
}
|
|
||||||
|
|
||||||
public EsRejectedExecutionException(String message, boolean isExecutorShutdown) {
|
|
||||||
this(message, isExecutorShutdown, new Object[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EsRejectedExecutionException() {
|
public EsRejectedExecutionException() {
|
||||||
super((String)null);
|
this(null, false);
|
||||||
this.isExecutorShutdown = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EsRejectedExecutionException(Throwable e) {
|
|
||||||
super(null, e);
|
|
||||||
this.isExecutorShutdown = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -79,4 +70,5 @@ public class EsRejectedExecutionException extends ElasticsearchException {
|
|||||||
public boolean isExecutorShutdown() {
|
public boolean isExecutorShutdown() {
|
||||||
return isExecutorShutdown;
|
return isExecutorShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user