Class DefaultReactiveConnectionStatus<C>

java.lang.Object
io.micronaut.data.connection.reactive.DefaultReactiveConnectionStatus<C>
Type Parameters:
C - The connection type
All Implemented Interfaces:
io.micronaut.core.propagation.PropagatedContextElement, ConnectionStatus<C>, ReactiveConnectionStatus<C>

@Internal public final class DefaultReactiveConnectionStatus<C> extends Object implements ReactiveConnectionStatus<C>
The default reactive connection status.
Since:
4.2.0
Author:
Denis Stepanov
  • Constructor Details

    • DefaultReactiveConnectionStatus

      public DefaultReactiveConnectionStatus(C connection, ConnectionDefinition definition, ReactorConnectionOperations<C> connectionOperations, boolean isNew)
    • DefaultReactiveConnectionStatus

      @Internal public DefaultReactiveConnectionStatus(C connection, ConnectionDefinition definition, ReactorConnectionOperations<C> connectionOperations, boolean isNew, @Nullable Executor executor)
      Parameters:
      connection - The connection
      definition - The connection definition
      connectionOperations - The connection operations
      isNew - Whether the connection was opened for this status
      executor - The executor the connection must be used on, if it is bound to a thread
      Since:
      5.3.0
  • Method Details

    • getExecutor

      @Internal public @Nullable Executor getExecutor()
      Returns:
      The executor the connection must be used on, or null if it can be used from any thread
      Since:
      5.3.0
    • getScheduler

      @Internal public @Nullable reactor.core.scheduler.Scheduler getScheduler()
      Returns:
      The scheduler of the connection's executor, or null if it can be used from any thread
      Since:
      5.3.0
    • onConnectionExecutor

      @Internal public <T> reactor.core.publisher.Mono<T> onConnectionExecutor(Supplier<? extends reactor.core.publisher.Mono<T>> work)
      Run the work on the connection's executor, if it has one.
      Type Parameters:
      T - The result type
      Parameters:
      work - The work
      Returns:
      The result
      Since:
      5.3.0
    • onConnectionExecutorFlux

      @Internal public <T> reactor.core.publisher.Flux<T> onConnectionExecutorFlux(Supplier<? extends reactor.core.publisher.Flux<T>> work)
      Run the work on the connection's executor, if it has one.
      Type Parameters:
      T - The result type
      Parameters:
      work - The work
      Returns:
      The result
      Since:
      5.3.0
    • isConnectionOf

      public boolean isConnectionOf(ReactorConnectionOperations<C> connectionOperations)
    • isNew

      public boolean isNew()
      Description copied from interface: ConnectionStatus
      A new connection value. Based on the propagation value the connection manager might decide to reuse the existing connection.
      Specified by:
      isNew in interface ConnectionStatus<C>
      Returns:
      true if the connection is new
    • getConnection

      public C getConnection()
      Description copied from interface: ConnectionStatus
      The connection representation.
      Specified by:
      getConnection in interface ConnectionStatus<C>
      Returns:
      The connection representation
    • getDefinition

      public ConnectionDefinition getDefinition()
      Description copied from interface: ConnectionStatus
      The connection definition.
      Specified by:
      getDefinition in interface ConnectionStatus<C>
      Returns:
      The connection definition
    • registerSynchronization

      public void registerSynchronization(ConnectionSynchronization synchronization)
      Description copied from interface: ConnectionStatus
      Register connection synchronization.
      Specified by:
      registerSynchronization in interface ConnectionStatus<C>
      Parameters:
      synchronization - The synchronization
    • registerReactiveSynchronization

      public void registerReactiveSynchronization(ReactiveConnectionSynchronization synchronization)
      Description copied from interface: ReactiveConnectionStatus
      Register reactive connection synchronization.
      Specified by:
      registerReactiveSynchronization in interface ReactiveConnectionStatus<C>
      Parameters:
      synchronization - The synchronization
    • onComplete

      public org.reactivestreams.Publisher<Void> onComplete(Supplier<org.reactivestreams.Publisher<Void>> closeConnection)
    • onError

      public org.reactivestreams.Publisher<Void> onError(Throwable outterThrowable, Supplier<org.reactivestreams.Publisher<Void>> closeConnection)
    • onCancel

      public org.reactivestreams.Publisher<Void> onCancel(Supplier<org.reactivestreams.Publisher<Void>> closeConnection)