Interface SmartExecutor
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
SmartExecutor.Direct,SmartExecutor.Limited,SmartExecutor.NonClosing,SmartExecutor.Pooled
public interface SmartExecutor extends java.lang.AutoCloseable
Utilities for executors and sizing them. Big fat note: Do not use this class outside of resolver. This and related classes are not meant as "drop in replacement" for Jave Executors, is used in very controlled fashion only.- Since:
- 2.0.11
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSmartExecutor.DirectDirect executor (caller executes).static classSmartExecutor.LimitedLimited executor, where the actual goal is to protect accessed resource, like when virtual threads are being used, so the "pool" itself does not provide any kind of back-pressure.static classSmartExecutor.NonClosingWrapper to prevent closing.static classSmartExecutor.PooledPooled executor backed byExecutorService.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Shut down this instance (ideally used in try-with-resource construct).voidsubmit(java.lang.Runnable runnable)Submits aRunnableto execution.<T> java.util.concurrent.Future<T>submit(java.util.concurrent.Callable<T> callable)Submits aCallableto execution, returns aCompletableFuture.
-
-
-
Method Detail
-
submit
void submit(java.lang.Runnable runnable)
Submits aRunnableto execution.
-
submit
<T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> callable)
Submits aCallableto execution, returns aCompletableFuture.
-
close
void close()
Shut down this instance (ideally used in try-with-resource construct).- Specified by:
closein interfacejava.lang.AutoCloseable
-
-