| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static interface | PreemptiveTimeoutUtils.
The type of error or exception created T extends Throwable>Factory for timeout failures. |
| private static class | PreemptiveTimeoutUtils.
The thread factory used for preemptive timeout. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <T extends @Nullable Object, E extends Throwable> T | executeWithPreemptiveTimeout(Duration timeout, ThrowingSupplier<T> supplier, @Nullable Supplier<@Nullable String> messageSupplier, PreemptiveTimeoutUtils.
Assert that execution of the supplied |
| private static <T extends @Nullable Object, E extends Throwable> T | resolveFutureAndHandleException(Future<T> future, Duration timeout, @Nullable Supplier<@Nullable String> messageSupplier, Supplier<@Nullable Thread> threadSupplier, PreemptiveTimeoutUtils.
|
| private static <T extends @Nullable Object> Future | submitTask(ThrowingSupplier<T> supplier, AtomicReference<Thread> threadReference, ExecutorService executorService)
|
| PreemptiveTimeoutUtils | back to summary |
|---|---|
| private PreemptiveTimeoutUtils() | |
| executeWithPreemptiveTimeout | back to summary |
|---|---|
| public static <T extends @Nullable Object, E extends Throwable> T executeWithPreemptiveTimeout(Duration timeout, ThrowingSupplier<T> supplier, @Nullable Supplier<@Nullable String> messageSupplier, PreemptiveTimeoutUtils. Assert that execution of the supplied See the Preemptive Timeouts section of the class-level Javadoc for further details. If the assertion passes then the In the case the assertion does not pass, the supplied
If necessary, the failure message will be retrieved lazily from the
supplied | |
| resolveFutureAndHandleException | back to summary |
|---|---|
| private static <T extends @Nullable Object, E extends Throwable> T resolveFutureAndHandleException(Future<T> future, Duration timeout, @Nullable Supplier<@Nullable String> messageSupplier, Supplier<@Nullable Thread> threadSupplier, PreemptiveTimeoutUtils. | |
| submitTask | back to summary |
|---|---|
| private static <T extends @Nullable Object> Future | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. | |
| ExecutionTimeoutException | back to summary |
|---|---|
| pack-priv ExecutionTimeoutException(String message) | |
PreemptiveTimeoutUtils#executeWithPreemptiveTimeout(Duration, ThrowingSupplier, Supplier, TimeoutFailureFactory)
| Modifier and Type | Method and Description |
|---|---|
| public T |
| createTimeoutFailure | back to summary |
|---|---|
| public T createTimeoutFailure(Duration timeout, @Nullable Supplier<@Nullable String> messageSupplier, @Nullable Throwable cause, @Nullable Thread testThread) Create a failure for the given timeout, message, and cause.
| |
The factory creates threads with meaningful names, helpful for debugging purposes.
| Modifier and Type | Field and Description |
|---|---|
| private static final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Thread | newThread(Runnable r)
Implements java. Constructs a new unstarted |
| threadNumber | back to summary |
|---|---|
| private static final AtomicInteger threadNumber | |
| TimeoutThreadFactory | back to summary |
|---|---|
| private TimeoutThreadFactory() | |
| newThread | back to summary |
|---|---|
| public Thread newThread(Runnable r) Implements java. Doc from java. Constructs a new unstarted
| |