Class LifeCycle

java.lang.Object
org.mockserver.lifecycle.LifeCycle
All Implemented Interfaces:
Closeable, AutoCloseable, Stoppable
Direct Known Subclasses:
MockServer

public abstract class LifeCycle extends Object implements Stoppable
Author:
jamesdbloom
  • Field Details

    • mockServerLogger

      protected final MockServerLogger mockServerLogger
    • bossGroup

      protected final io.netty.channel.EventLoopGroup bossGroup
    • workerGroup

      protected final io.netty.channel.EventLoopGroup workerGroup
    • forwardClientGroup

      protected final io.netty.channel.EventLoopGroup forwardClientGroup
    • httpState

      protected final HttpState httpState
    • serverServerBootstrap

      protected io.netty.bootstrap.ServerBootstrap serverServerBootstrap
  • Constructor Details

  • Method Details

    • requestProcessingStarted

      public void requestProcessingStarted()
      Mark that a data-plane request has started processing. Must be paired with exactly one requestProcessingComplete() call when the response has been written.
    • requestProcessingComplete

      public void requestProcessingComplete()
      Mark that a data-plane request has finished (its response has been written or the connection has otherwise completed). Callers must guard against double-invocation; the counter is never allowed to go negative.
    • getRequestsInFlight

      public int getRequestsInFlight()
      Returns:
      the number of data-plane requests currently being processed
    • stopAsync

      public CompletableFuture<String> stopAsync()
    • stop

      public void stop()
      Specified by:
      stop in interface Stoppable
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getEventLoopGroup

      protected io.netty.channel.EventLoopGroup getEventLoopGroup()
    • getForwardClientEventLoopGroup

      protected io.netty.channel.EventLoopGroup getForwardClientEventLoopGroup()
      Returns:
      the dedicated event-loop group for the outbound forward/proxy (loopback) HTTP client, kept disjoint from the server worker group so a pooled channel reused inside a synchronous local callback is never pinned to a blocked server worker thread (see field javadoc).
    • getScheduler

      public Scheduler getScheduler()
    • isRunning

      public boolean isRunning()
    • getLocalPorts

      public List<Integer> getLocalPorts()
    • getPort

      @Deprecated public Integer getPort()
      Deprecated.
      use getLocalPort instead of getPort
    • getLocalPort

      public int getLocalPort()
    • bindServerPorts

      public List<Integer> bindServerPorts(List<Integer> requestedPortBindings)
    • startedServer

      protected void startedServer(List<Integer> ports)
    • registerListener

      public LifeCycle registerListener(ExpectationsListener expectationsListener)