Class HttpTransport
java.lang.Object
com.predic8.membrane.core.transport.Transport
com.predic8.membrane.core.transport.http.HttpTransport
- 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.
-
Field Summary
Fields inherited from class com.predic8.membrane.core.transport.Transport
menuListeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseAll(boolean waitForCompletion) voidCloses the corresponding server port.intintintintgetOpenBackendConnections(int port) intvoidbooleanbooleanvoidopenPort(String ip, int port, SSLProvider sslProvider, TimerManager timerManager) voidsetBacklog(int backlog) voidsetCoreThreadPoolSize(int corePoolSize) voidsetForceSocketCloseOnHotDeployAfter(int forceSocketCloseOnHotDeployAfter) voidsetMaxThreadPoolSize(int value) voidsetSocketTimeout(int timeout) voidsetTcpNoDelay(boolean tcpNoDelay) Methods inherited from class com.predic8.membrane.core.transport.Transport
closeAll, getConcurrentConnectionLimitPerIp, getInterceptors, getRouter, isPrintStackTrace, isReverseDNS, setConcurrentConnectionLimitPerIp, setInterceptors, setPrintStackTrace, setReverseDNS
-
Constructor Details
-
HttpTransport
public HttpTransport()
-
-
Method Details
-
init
-
closePort
Closes the corresponding server port. Note that connections might still be open and exchanges still running after this method completes.- Throws:
IOException
-
closeAll
- Overrides:
closeAllin classTransport- Throws:
IOException
-
openPort
public void openPort(String ip, int port, SSLProvider sslProvider, @Nullable TimerManager timerManager) throws IOException - Overrides:
openPortin classTransport- Parameters:
port- Port to opentimerManager- timerManager- Throws:
IOException- If port can not be opened
-
getOpenBackendConnections
- Overrides:
getOpenBackendConnectionsin classTransport
-
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
-
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:
isOpeningPortsin classTransport
-
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
Routerobject (=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.
-