public class QuicResources extends Object implements LoopResources
Disposable.Composite, Disposable.SwapDEFAULT_IO_SELECT_COUNT, DEFAULT_IO_WORKER_COUNT, DEFAULT_NATIVE, DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT| Modifier | Constructor and Description |
|---|---|
protected |
QuicResources(LoopResources defaultLoops) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_dispose()
Dispose underlying resources
|
protected Mono<Void> |
_disposeLater(Duration quietPeriod,
Duration timeout)
Dispose underlying resources in a listenable fashion.
|
boolean |
daemon() |
void |
dispose()
This has a
NOOP implementation by default in order to prevent unintended disposal of
the global QUIC resources which has a longer lifecycle than regular LoopResources. |
Mono<Void> |
disposeLater()
This has a
NOOP implementation by default in order to prevent unintended disposal of
the global QUIC resources which has a longer lifecycle than regular LoopResources. |
Mono<Void> |
disposeLater(Duration quietPeriod,
Duration timeout)
This has a
NOOP implementation by default in order to prevent unintended disposal of
the global QUIC resources which has a longer lifecycle than regular LoopResources. |
static void |
disposeLoops()
Shutdown the global
QuicResources without resetting them,
effectively cleaning up associated resources without creating new ones. |
static Mono<Void> |
disposeLoopsLater()
Prepare to shut down the global
QuicResources without resetting them,
effectively cleaning up associated resources without creating new ones. |
static Mono<Void> |
disposeLoopsLater(Duration quietPeriod,
Duration timeout)
Prepare to shut down the global
QuicResources without resetting them,
effectively cleaning up associated resources without creating new ones. |
static QuicResources |
get()
Return the global QUIC resources for loops
|
protected static QuicResources |
getOrCreate(LoopResources loops,
Function<LoopResources,QuicResources> onNew,
String name)
Safely check if existing resource exist and proceed to update/cleanup if new
resources references are passed.
|
boolean |
isDisposed() |
<CHANNEL extends Channel> |
onChannel(Class<CHANNEL> channelType,
EventLoopGroup group) |
<CHANNEL extends Channel> |
onChannelClass(Class<CHANNEL> channelType,
EventLoopGroup group) |
EventLoopGroup |
onClient(boolean useNative) |
EventLoopGroup |
onServer(boolean useNative) |
EventLoopGroup |
onServerSelect(boolean useNative) |
static QuicResources |
reset()
Reset QUIC resources to default and return its instance
|
static QuicResources |
set(LoopResources loops)
Update event loops resources and return the global QUIC resources.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcolocate, create, create, create, hasNativeSupportprotected QuicResources(LoopResources defaultLoops)
public static QuicResources get()
public static QuicResources reset()
public static QuicResources set(LoopResources loops)
LoopResources will be disposed.loops - a new LoopResources to replace the currentpublic static void disposeLoops()
QuicResources without resetting them,
effectively cleaning up associated resources without creating new ones.
This method is NOT blocking. It is implemented as fire-and-forget.
Use disposeLoopsLater() when you need to observe the final
status of the operation, combined with Mono.block()
if you need to synchronously wait for the underlying resources to be disposed.public static Mono<Void> disposeLoopsLater()
QuicResources without resetting them,
effectively cleaning up associated resources without creating new ones. This only
occurs when the returned Mono is subscribed to.
The quiet period will be 2s and the timeout will be 15sMono triggering the disposeLoops() when subscribed to.public static Mono<Void> disposeLoopsLater(Duration quietPeriod, Duration timeout)
QuicResources without resetting them,
effectively cleaning up associated resources without creating new ones. This only
occurs when the returned Mono is subscribed to.
It is guaranteed that the disposal of the underlying LoopResources will not happen before
quietPeriod is over. If a task is submitted during the quietPeriod,
it is guaranteed to be accepted and the quietPeriod will start over.quietPeriod - the quiet period as described abovetimeout - the maximum amount of time to wait until the disposal of the underlying
LoopResources regardless if a task was submitted during the quiet periodMono triggering the disposeLoops() when subscribed to.public boolean daemon()
daemon in interface LoopResourcespublic void dispose()
NOOP implementation by default in order to prevent unintended disposal of
the global QUIC resources which has a longer lifecycle than regular LoopResources.
If a disposal of the global QUIC resources is needed, disposeLoops() should be used instead.dispose in interface Disposabledispose in interface LoopResourcespublic Mono<Void> disposeLater()
NOOP implementation by default in order to prevent unintended disposal of
the global QUIC resources which has a longer lifecycle than regular LoopResources.
If a disposal of the global QUIC resources is needed, disposeLoopsLater() should be used instead.disposeLater in interface LoopResourcespublic Mono<Void> disposeLater(Duration quietPeriod, Duration timeout)
NOOP implementation by default in order to prevent unintended disposal of
the global QUIC resources which has a longer lifecycle than regular LoopResources.
If a disposal of the global QUIC resources is needed, disposeLoopsLater(Duration, Duration)
should be used instead.disposeLater in interface LoopResourcespublic boolean isDisposed()
isDisposed in interface Disposablepublic <CHANNEL extends Channel> CHANNEL onChannel(Class<CHANNEL> channelType, EventLoopGroup group)
onChannel in interface LoopResourcespublic <CHANNEL extends Channel> Class<? extends CHANNEL> onChannelClass(Class<CHANNEL> channelType, EventLoopGroup group)
onChannelClass in interface LoopResourcespublic EventLoopGroup onClient(boolean useNative)
onClient in interface LoopResourcespublic EventLoopGroup onServer(boolean useNative)
onServer in interface LoopResourcespublic EventLoopGroup onServerSelect(boolean useNative)
onServerSelect in interface LoopResourcesprotected void _dispose()
protected Mono<Void> _disposeLater(Duration quietPeriod, Duration timeout)
quietPeriod is over. If a task is submitted during the quietPeriod,
it is guaranteed to be accepted and the quietPeriod will start over.quietPeriod - the quiet period as described abovetimeout - the maximum amount of time to wait until the disposal of the underlying
LoopResources regardless if a task was submitted during the quiet periodprotected static QuicResources getOrCreate(@Nullable LoopResources loops, Function<LoopResources,QuicResources> onNew, String name)
loops - the eventual new LoopResourcesonNew - a QuicResources factoryname - a name for resourcesQuicResources