apache/seatunnel · info · IllegalStateException
Utility class
Error message
Utility class
What it means
IllegalStateException thrown from the private constructor of RequestFutureCache, a static utility class holding pending request futures. This is a defensive guard to prevent instantiation of the class, which only exposes static methods. It only fires if a developer tries `new RequestFutureCache()` via reflection, serialization, or inside the same class.
Solutions
- Remove any code that instantiates RequestFutureCache and call its static methods instead
- If instantiation is intentional, refactor the needed functionality into a non-utility class
- In tests, suppress instantiation attempts rather than calling the constructor
Example fix
// before RequestFutureCache cache = new RequestFutureCache(); // after RequestFuture future = RequestFutureCache.get(requestId); // use static access
Defensive patterns
Strategy: type-guard
Validate before calling
// never instantiate; just use statics assert Modifier.isPrivate(RequestFutureCache.class.getDeclaredConstructor().getModifiers());
Prevention
- Treat utility classes as static-only; never reflectively instantiate them
- Use static method calls directly on RequestFutureCache
- Enable IDE inspections that flag instantiation of private-constructor utility classes
When it happens
Trigger: Any attempt to instantiate RequestFutureCache: direct constructor call (impossible from outside due to private access), reflection with setAccessible(true), or accidental deserialization of the class.
Common situations: Refactor or test code trying to instantiate utility classes; reflection-based frameworks (e.g. some mocking or serialization tools) probing constructors.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- ACKNOWLEDGE_FAILED
- Already an MDCCallable
- Already an MDCComparator
- Already an MDCConsumer
- Already an MDCExecutor
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/6222f3ae32204901.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/future/RequestFutureCache.java:29
*
* 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 org.apache.seatunnel.engine.imap.storage.file.future;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
public class RequestFutureCache {
private RequestFutureCache() {
throw new IllegalStateException("Utility class");
}
private static AtomicLong REQUEST_ID_GEN = new AtomicLong(0);
private static ConcurrentHashMap<Long, RequestFuture> REQUEST_MAP = new ConcurrentHashMap<>();
public static void put(long requestId, RequestFuture requestFuture) {
REQUEST_MAP.put(requestId, requestFuture);
}
public static RequestFuture get(Long requestId) {
return REQUEST_MAP.get(requestId);
}
public static void remove(Long requestId) {
REQUEST_MAP.remove(requestId);
}
View on GitHub (pinned to cf67b549a7)