@FunctionalInterface public interface LoopResources extends Disposable
EventLoopGroup
selector with associated
Channel
factories.Disposable.Composite, Disposable.Swap
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_IO_SELECT_COUNT
Default selector thread count, fallback to -1 (no selector thread)
|
static int |
DEFAULT_IO_WORKER_COUNT
Default worker thread count, fallback to available processor
(but with a minimum value of 4)
|
static boolean |
DEFAULT_NATIVE
Default value whether the native transport (epoll, kqueue) will be preferred,
fallback it will be preferred when available
|
Modifier and Type | Method and Description |
---|---|
static EventLoopGroup |
colocate(EventLoopGroup group)
Create a delegating
EventLoopGroup which reuse local event loop if already
working
inside one. |
static LoopResources |
create(String prefix)
|
static LoopResources |
create(String prefix,
int workerCount,
boolean daemon)
|
static LoopResources |
create(String prefix,
int selectCount,
int workerCount,
boolean daemon)
|
default boolean |
daemon()
return true if
EventLoopGroup should not be shutdown |
default void |
dispose() |
default Mono<Void> |
disposeLater()
Returns a Mono that triggers the disposal of underlying resources when subscribed to.
|
default Class<? extends Channel> |
onChannel(EventLoopGroup group)
Callback for client or generic channel factory selection.
|
default EventLoopGroup |
onClient(boolean useNative)
Callback for client
EventLoopGroup creation. |
default Class<? extends DatagramChannel> |
onDatagramChannel(EventLoopGroup group)
Callback for UDP channel factory selection.
|
EventLoopGroup |
onServer(boolean useNative)
Callback for server
EventLoopGroup creation. |
default Class<? extends ServerChannel> |
onServerChannel(EventLoopGroup group)
Callback for server channel factory selection.
|
default EventLoopGroup |
onServerSelect(boolean useNative)
Create a server select
EventLoopGroup for servers to be used |
default boolean |
preferNative()
Return true if should default to native
EventLoopGroup and Channel |
isDisposed
static final int DEFAULT_IO_WORKER_COUNT
static final int DEFAULT_IO_SELECT_COUNT
static final boolean DEFAULT_NATIVE
static EventLoopGroup colocate(EventLoopGroup group)
EventLoopGroup
which reuse local event loop if already
working
inside one.group
- the EventLoopGroup
to decorateEventLoopGroup
that will colocate executions on the
same thread stackstatic LoopResources create(String prefix, int workerCount, boolean daemon)
prefix
- the event loop thread name prefixworkerCount
- number of worker threadsdaemon
- should the thread be released on jvm shutdownLoopResources
to provide automatically for EventLoopGroup
and Channel
factoriesstatic LoopResources create(String prefix, int selectCount, int workerCount, boolean daemon)
prefix
- the event loop thread name prefixselectCount
- number of selector threadsworkerCount
- number of worker threadsdaemon
- should the thread be released on jvm shutdownLoopResources
to provide automatically for EventLoopGroup
and Channel
factoriesstatic LoopResources create(String prefix)
prefix
- the event loop thread name prefixLoopResources
to provide automatically for EventLoopGroup
and Channel
factoriesdefault Class<? extends Channel> onChannel(EventLoopGroup group)
group
- the source EventLoopGroup
to assign a loop fromClass
target for the underlying Channel
factorydefault EventLoopGroup onClient(boolean useNative)
EventLoopGroup
creation.useNative
- should use native group if current preferNative()
is also
trueEventLoopGroup
default Class<? extends DatagramChannel> onDatagramChannel(EventLoopGroup group)
group
- the source EventLoopGroup
to assign a loop fromClass
target for the underlying Channel
factoryEventLoopGroup onServer(boolean useNative)
EventLoopGroup
creation.useNative
- should use native group if current preferNative()
is also
trueEventLoopGroup
default Class<? extends ServerChannel> onServerChannel(EventLoopGroup group)
group
- the source EventLoopGroup
to assign a loop fromClass
target for the underlying ServerChannel
factorydefault EventLoopGroup onServerSelect(boolean useNative)
EventLoopGroup
for servers to be useduseNative
- should use native group if current preferNative()
is also
trueEventLoopGroup
default boolean preferNative()
EventLoopGroup
and Channel
EventLoopGroup
and Channel
default boolean daemon()
EventLoopGroup
should not be shutdownEventLoopGroup
should not be shutdowndefault void dispose()
dispose
in interface Disposable