From 29c15e841944cfaf34339d36fe353a32cfe19c17 Mon Sep 17 00:00:00 2001 From: Carter Kozak Date: Mon, 28 Sep 2020 13:53:33 -0400 Subject: [PATCH] Remove the ViewExecutor artificial size limit Unlike the previous implementations, EnhancedViewExecutor stores state in a 64-bit integer, allowing both the pool and queue sizes to use full integers. There's not any reason to create an executor with more than 32k active tasks, however the builder uses the `int` type so it's nice to allow `Integer.MAX_VALUE` to have effectively the same impact as `Short.MAX_VALUE` and rely on the compiler for input validation. --- src/main/java/org/jboss/threads/ViewExecutor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jboss/threads/ViewExecutor.java b/src/main/java/org/jboss/threads/ViewExecutor.java index 2d51af7..acbb71c 100644 --- a/src/main/java/org/jboss/threads/ViewExecutor.java +++ b/src/main/java/org/jboss/threads/ViewExecutor.java @@ -50,7 +50,7 @@ public static Builder builder(Executor delegate) { public static final class Builder { private final Executor delegate; - private short maxSize = 1; + private int maxSize = 1; private int queueLimit = Integer.MAX_VALUE; private Thread.UncaughtExceptionHandler handler = JBossExecutors.loggingExceptionHandler(); @@ -64,8 +64,7 @@ public int getMaxSize() { public Builder setMaxSize(final int maxSize) { Assert.checkMinimumParameter("maxSize", 1, maxSize); - Assert.checkMaximumParameter("maxSize", Short.MAX_VALUE, maxSize); - this.maxSize = (short) maxSize; + this.maxSize = maxSize; return this; }