Class HttpTransport

java.lang.Object
com.predic8.membrane.core.transport.Transport
com.predic8.membrane.core.transport.http.HttpTransport

public class HttpTransport extends Transport
Description

The transport receives messages from clients and invokes interceptors in the request and response flow. The interceptors that are engaged with the transport are global and are invoked for each message flowing through the router.

  • Constructor Details

    • HttpTransport

      public HttpTransport()
  • Method Details

    • init

      public void init(Router router) throws Exception
      Overrides:
      init in class Transport
      Throws:
      Exception
    • closePort

      public void closePort(IpPort p) throws IOException
      Closes the corresponding server port. Note that connections might still be open and exchanges still running after this method completes.
      Throws:
      IOException
    • closeAll

      public void closeAll(boolean waitForCompletion) throws IOException
      Overrides:
      closeAll in class Transport
      Throws:
      IOException
    • openPort

      public void openPort(String ip, int port, SSLProvider sslProvider, @Nullable TimerManager timerManager) throws IOException
      Overrides:
      openPort in class Transport
      Parameters:
      port - Port to open
      timerManager - timerManager
      Throws:
      IOException - If port can not be opened
    • getOpenBackendConnections

      public String getOpenBackendConnections(int port)
      Overrides:
      getOpenBackendConnections in class Transport
    • getCoreThreadPoolSize

      public int getCoreThreadPoolSize()
    • setCoreThreadPoolSize

      public void setCoreThreadPoolSize(int corePoolSize)
      Default
      20
      Description

      Membrane uses a thread pool to allocate threads to incomming clients connections. The core thread pool size is the minimum number of threads that are created in advance to serve client requests.

      Example
      5
    • getMaxThreadPoolSize

      public int getMaxThreadPoolSize()
    • setMaxThreadPoolSize

      public void setMaxThreadPoolSize(int value)
      Default
      no limit
      Description
      Maximum number of threads to handle incoming connections. (Membrane uses 1 thread per incoming connection.)
      Example
      300
    • getExecutorService

      public ExecutorService getExecutorService()
    • getSocketTimeout

      public int getSocketTimeout()
    • setSocketTimeout

      public void setSocketTimeout(int timeout)
      Default
      30000
      Description
      Socket timout in ms.
    • isTcpNoDelay

      public boolean isTcpNoDelay()
    • setTcpNoDelay

      public void setTcpNoDelay(boolean tcpNoDelay)
      Default
      true
      Description
      Whether to use the "TCP no delay" option. (=A TCP/IP packet should be constructed as soon as any data has been written to the network buffer. With "TCP no delay" set to false, the network hardware waits a short period of time wether the software will write more data. When the packet constructed from the data in the buffer would exceed the MTU in size, the packet is always constructed and sent immediately.)
    • isOpeningPorts

      public boolean isOpeningPorts()
      Specified by:
      isOpeningPorts in class Transport
    • getForceSocketCloseOnHotDeployAfter

      public int getForceSocketCloseOnHotDeployAfter()
    • setForceSocketCloseOnHotDeployAfter

      public void setForceSocketCloseOnHotDeployAfter(int forceSocketCloseOnHotDeployAfter)
      Default
      30000
      Description
      When proxies.xml is changed and <router hotDeploy="true">, the Spring Context is automatically refreshed, which restarts the Router object (=Membrane API Gateway). Before the context refresh, all open socket connections have to be closed. Exchange objects which are still running might delay this process. Setting forceSocketCloseOnHotDeployAfter to a non-zero number of milliseconds forces connections to be closed after this time.
    • getBacklog

      public int getBacklog()
    • setBacklog

      public void setBacklog(int backlog)
      Default
      50
      Description
      The backlog value passed to ServerSocket(int, int, InetAddress). The maximum length of the queue of incoming connections.