类 PortInUseException

所有已实现的接口:
Serializable

public class PortInUseException extends WebServerException
A PortInUseException is thrown when a web server fails to start due to a port already being in use.
从以下版本开始:
2.0.0
作者:
Andy Wilkinson, Phillip Webb
另请参阅:
  • 构造器详细资料

    • PortInUseException

      public PortInUseException(int port)
      Creates a new port in use exception for the given port.
      参数:
      port - the port that was in use
    • PortInUseException

      public PortInUseException(int port, Throwable cause)
      Creates a new port in use exception for the given port.
      参数:
      port - the port that was in use
      cause - the cause of the exception
  • 方法详细资料

    • getPort

      public int getPort()
      Returns the port that was in use.
      返回:
      the port
    • throwIfPortBindingException

      public static void throwIfPortBindingException(Exception ex, IntSupplier port)
      Throw a PortInUseException if the given exception was caused by a "port in use" BindException.
      参数:
      ex - the source exception
      port - a suppler used to provide the port
      从以下版本开始:
      2.2.7
    • ifPortBindingException

      public static void ifPortBindingException(Exception ex, Consumer<BindException> action)
      Perform an action if the given exception was caused by a "port in use" BindException.
      参数:
      ex - the source exception
      action - the action to perform
      从以下版本开始:
      2.2.7
    • ifCausedBy

      public static <E extends Exception> void ifCausedBy(Exception ex, Class<E> causedBy, Consumer<E> action)
      Perform an action if the given exception was caused by a specific exception type.
      类型参数:
      E - the cause exception type
      参数:
      ex - the source exception
      causedBy - the required cause type
      action - the action to perform
      从以下版本开始:
      2.2.7