Package io.servicetalk.transport.api
Interface IoExecutor
- All Superinterfaces:
AsyncCloseable,Executor,Executor,ListenableAsyncCloseable,TimeSource
- All Known Subinterfaces:
EventLoopAwareNettyIoExecutor,NettyIoExecutor
Executor that handles network transport I/O operations.
This executor is specifically designed for network-related I/O operations such as socket connections. It is not intended for general I/O operations or general offloading work.
-
Method Summary
Modifier and TypeMethodDescriptiondefault CancellableExecutes the passedtaskas soon as possible.booleanDetermine if fd addresses are supported.booleanDetermine if threads used by thisIoExecutorare marked withIoThreadFactory.IoThreadinterface.booleanDetermine if Unix Domain Sockets are supported.default CancellableExecutes the passedtaskafterdelayamount ofunits time has passed.default BooleanSupplierReturns a boolean supplier, if this IoExecutor supportsIoThreadFactory.IoThreadmarkers, that conditionally recommends offloading if the current thread is a network I/O thread.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.api.Executor
submit, submit, submitCallable, submitRunnable, timer, timerMethods inherited from interface io.servicetalk.concurrent.Executor
currentTime, scheduleMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
isUnixDomainSocketSupported
boolean isUnixDomainSocketSupported()Determine if Unix Domain Sockets are supported.- Returns:
trueif Unix Domain Sockets are supported.
-
isFileDescriptorSocketAddressSupported
boolean isFileDescriptorSocketAddressSupported()Determine if fd addresses are supported.- Returns:
trueif supported
-
isIoThreadSupported
boolean isIoThreadSupported()Determine if threads used by thisIoExecutorare marked withIoThreadFactory.IoThreadinterface.- Returns:
trueif supported- See Also:
-
shouldOffloadSupplier
Returns a boolean supplier, if this IoExecutor supportsIoThreadFactory.IoThreadmarkers, that conditionally recommends offloading if the current thread is a network I/O thread. If this IoExecutor does not support IoThread marker interface then the boolean supplier will always returntrue.- Returns:
- a Boolean supplier to recommend offloading appropriately based upon IoExecutor configuration.
-
execute
Description copied from interface:ExecutorExecutes the passedtaskas soon as possible.- Specified by:
executein interfaceExecutor- Parameters:
task- to execute.- Returns:
Cancellableto cancel the task if not yet executed.- Throws:
RejectedExecutionException- If the task is rejected.
-
schedule
default Cancellable schedule(Runnable task, long delay, TimeUnit unit) throws RejectedExecutionException Description copied from interface:ExecutorExecutes the passedtaskafterdelayamount ofunits time has passed.Note this method is not guaranteed to provide real time execution. For example implementations are free to consolidate tasks into time buckets to reduce the overhead of timer management at the cost of reduced timer fidelity.
- Specified by:
schedulein interfaceExecutor- Parameters:
task- to execute.delay- The time duration that is allowed to elapse beforetaskis executed.unit- The units fordelay.- Returns:
Cancellableto cancel the task if not yet executed.- Throws:
RejectedExecutionException- If the task is rejected.
-