Class QuicResources

java.lang.Object
reactor.netty.quic.QuicResources
All Implemented Interfaces:
Disposable, LoopResources

public class QuicResources extends Object implements LoopResources
Hold the default QUIC resources.
Author:
Violeta Georgieva
  • Constructor Details

    • QuicResources

      protected QuicResources(LoopResources defaultLoops)
  • Method Details

    • get

      public static QuicResources get()
      Return the global QUIC resources for loops.
      Returns:
      the global QUIC resources for loops
    • reset

      public static QuicResources reset()
      Reset QUIC resources to default and return its instance.
      Returns:
      the global QUIC resources
    • set

      public static QuicResources set(LoopResources loops)
      Update event loops resources and return the global QUIC resources. Note: The previous LoopResources will be disposed.
      Parameters:
      loops - a new LoopResources to replace the current
      Returns:
      the global QUIC resources
    • disposeLoops

      public static void disposeLoops()
      Shutdown the global 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.
    • disposeLoopsLater

      public static Mono<Void> disposeLoopsLater()
      Prepare to shut down the global 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 15s
      Returns:
      a Mono triggering the disposeLoops() when subscribed to.
    • disposeLoopsLater

      public 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. 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.
      Parameters:
      quietPeriod - the quiet period as described above
      timeout - the maximum amount of time to wait until the disposal of the underlying LoopResources regardless if a task was submitted during the quiet period
      Returns:
      a Mono triggering the disposeLoops() when subscribed to.
      Since:
      0.9.3
    • daemon

      public boolean daemon()
      Specified by:
      daemon in interface LoopResources
    • dispose

      public 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. If a disposal of the global QUIC resources is needed, disposeLoops() should be used instead.
      Specified by:
      dispose in interface Disposable
      Specified by:
      dispose in interface LoopResources
    • disposeLater

      public 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. If a disposal of the global QUIC resources is needed, disposeLoopsLater() should be used instead.
      Specified by:
      disposeLater in interface LoopResources
    • disposeLater

      public 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. If a disposal of the global QUIC resources is needed, disposeLoopsLater(Duration, Duration) should be used instead.
      Specified by:
      disposeLater in interface LoopResources
    • isDisposed

      public boolean isDisposed()
      Specified by:
      isDisposed in interface Disposable
    • onChannel

      public <CHANNEL extends Channel> CHANNEL onChannel(Class<CHANNEL> channelType, EventLoopGroup group)
      Specified by:
      onChannel in interface LoopResources
    • onChannelClass

      public <CHANNEL extends Channel> Class<? extends CHANNEL> onChannelClass(Class<CHANNEL> channelType, EventLoopGroup group)
      Specified by:
      onChannelClass in interface LoopResources
    • onClient

      public EventLoopGroup onClient(boolean useNative)
      Specified by:
      onClient in interface LoopResources
    • onServer

      public EventLoopGroup onServer(boolean useNative)
      Specified by:
      onServer in interface LoopResources
    • onServerSelect

      public EventLoopGroup onServerSelect(boolean useNative)
      Specified by:
      onServerSelect in interface LoopResources
    • _dispose

      protected void _dispose()
      Dispose underlying resources.
    • _disposeLater

      protected Mono<Void> _disposeLater(Duration quietPeriod, Duration timeout)
      Dispose underlying resources in a listenable fashion. 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.
      Parameters:
      quietPeriod - the quiet period as described above
      timeout - the maximum amount of time to wait until the disposal of the underlying LoopResources regardless if a task was submitted during the quiet period
      Returns:
      the Mono that represents the end of disposal
    • getOrCreate

      protected static QuicResources getOrCreate(@Nullable 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.
      Parameters:
      loops - the eventual new LoopResources
      onNew - a QuicResources factory
      name - a name for resources
      Returns:
      an existing or new QuicResources