Class TransportHealth.Builder

java.lang.Object
express.mvp.myra.transport.TransportHealth.Builder
Enclosing class:
TransportHealth

public static final class TransportHealth.Builder extends Object
Builder for constructing TransportHealth instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • healthy

      public TransportHealth.Builder healthy(boolean healthy)
      Sets the overall health status.
      Parameters:
      healthy - true if healthy
      Returns:
      this builder for chaining
    • activeConnections

      public TransportHealth.Builder activeConnections(int count)
      Sets the active connection count.
      Parameters:
      count - the number of active connections
      Returns:
      this builder for chaining
    • pendingOperations

      public TransportHealth.Builder pendingOperations(int count)
      Sets the pending operation count.
      Parameters:
      count - the number of pending operations
      Returns:
      this builder for chaining
    • totalBytesSent

      public TransportHealth.Builder totalBytesSent(long bytes)
      Sets the total bytes sent counter.
      Parameters:
      bytes - cumulative bytes sent
      Returns:
      this builder for chaining
    • totalBytesReceived

      public TransportHealth.Builder totalBytesReceived(long bytes)
      Sets the total bytes received counter.
      Parameters:
      bytes - cumulative bytes received
      Returns:
      this builder for chaining
    • lastError

      public TransportHealth.Builder lastError(Instant timestamp, String message)
      Records an error, which also sets healthy to false.
      Parameters:
      timestamp - when the error occurred
      message - description of the error
      Returns:
      this builder for chaining
    • build

      public TransportHealth build()
      Builds the health snapshot.
      Returns:
      a new immutable TransportHealth