blob: 54ec767f8e0015dd38556ec1403a94e16f7f413f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
package com.it_jaros.jscanner.scan.engine;
/**
* A sealed interface representing the three possible outcomes of a CompletionService
* poll operation: successful result, task failure, or not ready yet.
* Makes error handling explicit — Failure and Unavailable are distinct and compile-time
* required to handle via exhaustiveness checking in switch statements.
*/
public sealed interface PollState<T> {
record Success<T>(T value) implements PollState<T> {}
record Failure<T>(Throwable error) implements PollState<T> {}
record Unavailable<T>() implements PollState<T> {}
}
|