Package io.servicetalk.transport.api
Interface IoExecutor
- All Superinterfaces:
AsyncCloseable
,Executor
,Executor
,ListenableAsyncCloseable
,TimeSource
- All Known Subinterfaces:
EventLoopAwareNettyIoExecutor
,NettyIoExecutor
Executor
that handles IO.-
Method Summary
Modifier and TypeMethodDescriptiondefault Cancellable
Executes the passedtask
as soon as possible.boolean
Determine if fd addresses are supported.boolean
Determine if threads used by thisIoExecutor
are marked withIoThreadFactory.IoThread
interface.boolean
Determine if Unix Domain Sockets are supported.default Cancellable
Executes the passedtask
afterdelay
amount ofunit
s time has passed.default BooleanSupplier
Returns a boolean supplier, if this IoExecutor supportsIoThreadFactory.IoThread
markers, that conditionally recommends offloading if the current thread is an IO thread.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.concurrent.api.Executor
submit, submit, submitCallable, submitRunnable, timer, timer
Methods inherited from interface io.servicetalk.concurrent.Executor
currentTime, schedule
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
isUnixDomainSocketSupported
boolean isUnixDomainSocketSupported()Determine if Unix Domain Sockets are supported.- Returns:
true
if Unix Domain Sockets are supported.
-
isFileDescriptorSocketAddressSupported
boolean isFileDescriptorSocketAddressSupported()Determine if fd addresses are supported.- Returns:
true
if supported
-
isIoThreadSupported
boolean isIoThreadSupported()Determine if threads used by thisIoExecutor
are marked withIoThreadFactory.IoThread
interface.- Returns:
true
if supported- See Also:
-
shouldOffloadSupplier
Returns a boolean supplier, if this IoExecutor supportsIoThreadFactory.IoThread
markers, that conditionally recommends offloading if the current thread is an IO 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:Executor
Executes the passedtask
as soon as possible.- Specified by:
execute
in interfaceExecutor
- Parameters:
task
- to execute.- Returns:
Cancellable
to 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:Executor
Executes the passedtask
afterdelay
amount ofunit
s 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:
schedule
in interfaceExecutor
- Parameters:
task
- to execute.delay
- The time duration that is allowed to elapse beforetask
is executed.unit
- The units fordelay
.- Returns:
Cancellable
to cancel the task if not yet executed.- Throws:
RejectedExecutionException
- If the task is rejected.
-