Package org.apache.tomcat.util.net
Class SocketProperties
java.lang.Object
org.apache.tomcat.util.net.SocketProperties
Properties that can be set in the <Connector> element
 in server.xml. All properties are prefixed with "socket."
 and are currently only working for the Nio connector
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intThe application read buffer size in bytes.protected intThe application write buffer size in bytes Default value is txBufSizeprotected intNioChannel pool size for the endpoint, this value is how many channels -1 means unlimited cached, 0 means no cache Default value is 500 TODO: The default should be changed in Tomcat 10, actually it should be bufferPoolSize / (appReadBufSize + appWriteBufSize), assuming the SSL buffers are ignored (that would be logical), and the value would be 6400.protected intBuffer pool size in bytes to be cached -1 means unlimited, 0 means no cache Default value is 100MB (1024*1024*100 bytes) TODO: The default value to be used could rather be based on the JVM max heap, otherwise it could be a problem in some environments.protected booleanEnable/disable direct buffers for the network buffers Default value is disabledprotected booleanEnable/disable direct buffers for the network buffers for SSL Default value is disabledprotected intEnable/disable poller event cache, this bounded cache stores PollerEvent objects to reduce GC for the poller Default is 500 -1 is unlimited 0 is disabled >0 the max number of objects to keep in cache.protected BooleanOOBINLINE option.protected IntegerPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.protected IntegerPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.protected IntegerPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.protected intEnable/disable socket processor cache, this bounded cache stores SocketProcessor objects to reduce GC Default is 500 -1 is unlimited 0 is disabled TODO: The default will be changed to 0 in Tomcat 10protected IntegerSocket receive buffer size in bytes (SO_RCVBUF).protected BooleanSO_KEEPALIVE option.protected BooleanSO_LINGER option, paired with thesoLingerTimevalue.protected IntegerSO_LINGER option, paired with thesoLingerOnvalue.protected BooleanSO_REUSEADDR option.protected IntegerSO_TIMEOUT option. default is 20000.protected BooleanTCP_NO_DELAY option.protected longThe minimum frequency of the timeout interval to avoid excess load from the poller during high trafficprotected IntegerSocket send buffer size in bytes (SO_SNDBUF).protected intTimeout in milliseconds for an unlock to take place.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintintintintbooleanintbooleanintbooleanintintintintintbooleanbooleanintbooleanintbooleanlongintintvoidsetAppReadBufSize(int appReadBufSize) voidsetAppWriteBufSize(int appWriteBufSize) voidsetBufferPool(int bufferPool) voidsetBufferPoolSize(int bufferPoolSize) voidsetDirectBuffer(boolean directBuffer) voidsetDirectBufferPool(int directBufferPool) voidsetDirectSslBuffer(boolean directSslBuffer) voidsetEventCache(int eventCache) voidsetOoBInline(boolean ooBInline) voidsetPerformanceBandwidth(int performanceBandwidth) voidsetPerformanceConnectionTime(int performanceConnectionTime) voidsetPerformanceLatency(int performanceLatency) voidsetProcessorCache(int processorCache) voidsetProperties(ServerSocket socket) voidsetProperties(Socket socket) voidvoidvoidsetRxBufSize(int rxBufSize) voidsetSoKeepAlive(boolean soKeepAlive) voidsetSoLingerOn(boolean soLingerOn) voidsetSoLingerTime(int soLingerTime) voidsetSoReuseAddress(boolean soReuseAddress) voidsetSoTimeout(int soTimeout) voidsetTcpNoDelay(boolean tcpNoDelay) voidsetTimeoutInterval(long timeoutInterval) voidsetTxBufSize(int txBufSize) voidsetUnlockTimeout(int unlockTimeout) 
- 
Field Details- 
processorCacheprotected int processorCacheEnable/disable socket processor cache, this bounded cache stores SocketProcessor objects to reduce GC Default is 500 -1 is unlimited 0 is disabled TODO: The default will be changed to 0 in Tomcat 10
- 
eventCacheprotected int eventCacheEnable/disable poller event cache, this bounded cache stores PollerEvent objects to reduce GC for the poller Default is 500 -1 is unlimited 0 is disabled >0 the max number of objects to keep in cache. TODO: The default will be changed to 0 in Tomcat 10
- 
directBufferprotected boolean directBufferEnable/disable direct buffers for the network buffers Default value is disabled
- 
directSslBufferprotected boolean directSslBufferEnable/disable direct buffers for the network buffers for SSL Default value is disabled
- 
rxBufSizeSocket receive buffer size in bytes (SO_RCVBUF). JVM default used if not set.
- 
txBufSizeSocket send buffer size in bytes (SO_SNDBUF). JVM default used if not set.
- 
appReadBufSizeprotected int appReadBufSizeThe application read buffer size in bytes. Default value is rxBufSize
- 
appWriteBufSizeprotected int appWriteBufSizeThe application write buffer size in bytes Default value is txBufSize
- 
bufferPoolprotected int bufferPoolNioChannel pool size for the endpoint, this value is how many channels -1 means unlimited cached, 0 means no cache Default value is 500 TODO: The default should be changed in Tomcat 10, actually it should be bufferPoolSize / (appReadBufSize + appWriteBufSize), assuming the SSL buffers are ignored (that would be logical), and the value would be 6400. So the default value will be changed to a new default value like -2 to set a dynamic value based on bufferPoolSize in that case.
- 
bufferPoolSizeprotected int bufferPoolSizeBuffer pool size in bytes to be cached -1 means unlimited, 0 means no cache Default value is 100MB (1024*1024*100 bytes) TODO: The default value to be used could rather be based on the JVM max heap, otherwise it could be a problem in some environments. Big servers also need to use a much higher default, while small cloud based ones should use 0 instead. Possible default value strategy: heap inf 1GB: 0 heap sup 1GB: heap / 32
- 
tcpNoDelayTCP_NO_DELAY option. JVM default used if not set.
- 
soKeepAliveSO_KEEPALIVE option. JVM default used if not set.
- 
ooBInlineOOBINLINE option. JVM default used if not set.
- 
soReuseAddressSO_REUSEADDR option. JVM default used if not set.
- 
soLingerOnSO_LINGER option, paired with thesoLingerTimevalue. JVM defaults used unless both attributes are set.
- 
soLingerTimeSO_LINGER option, paired with thesoLingerOnvalue. JVM defaults used unless both attributes are set.
- 
soTimeoutSO_TIMEOUT option. default is 20000.
- 
performanceConnectionTimePerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.
- 
performanceLatencyPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.
- 
performanceBandwidthPerformance preferences according to https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.
- 
timeoutIntervalprotected long timeoutIntervalThe minimum frequency of the timeout interval to avoid excess load from the poller during high traffic
- 
unlockTimeoutprotected int unlockTimeoutTimeout in milliseconds for an unlock to take place.
 
- 
- 
Constructor Details- 
SocketPropertiespublic SocketProperties()
 
- 
- 
Method Details- 
setProperties- Throws:
- SocketException
 
- 
setProperties- Throws:
- SocketException
 
- 
setProperties- Throws:
- IOException
 
- 
setProperties- Throws:
- IOException
 
- 
getDirectBufferpublic boolean getDirectBuffer()
- 
getDirectSslBufferpublic boolean getDirectSslBuffer()
- 
getOoBInlinepublic boolean getOoBInline()
- 
getPerformanceBandwidthpublic int getPerformanceBandwidth()
- 
getPerformanceConnectionTimepublic int getPerformanceConnectionTime()
- 
getPerformanceLatencypublic int getPerformanceLatency()
- 
getRxBufSizepublic int getRxBufSize()
- 
getSoKeepAlivepublic boolean getSoKeepAlive()
- 
getSoLingerOnpublic boolean getSoLingerOn()
- 
getSoLingerTimepublic int getSoLingerTime()
- 
getSoReuseAddresspublic boolean getSoReuseAddress()
- 
getSoTimeoutpublic int getSoTimeout()
- 
getTcpNoDelaypublic boolean getTcpNoDelay()
- 
getTxBufSizepublic int getTxBufSize()
- 
getBufferPoolpublic int getBufferPool()
- 
getBufferPoolSizepublic int getBufferPoolSize()
- 
getEventCachepublic int getEventCache()
- 
getAppReadBufSizepublic int getAppReadBufSize()
- 
getAppWriteBufSizepublic int getAppWriteBufSize()
- 
getProcessorCachepublic int getProcessorCache()
- 
getTimeoutIntervalpublic long getTimeoutInterval()
- 
getDirectBufferPoolpublic int getDirectBufferPool()
- 
setPerformanceConnectionTimepublic void setPerformanceConnectionTime(int performanceConnectionTime) 
- 
setTxBufSizepublic void setTxBufSize(int txBufSize) 
- 
setTcpNoDelaypublic void setTcpNoDelay(boolean tcpNoDelay) 
- 
setSoTimeoutpublic void setSoTimeout(int soTimeout) 
- 
setSoReuseAddresspublic void setSoReuseAddress(boolean soReuseAddress) 
- 
setSoLingerTimepublic void setSoLingerTime(int soLingerTime) 
- 
setSoKeepAlivepublic void setSoKeepAlive(boolean soKeepAlive) 
- 
setRxBufSizepublic void setRxBufSize(int rxBufSize) 
- 
setPerformanceLatencypublic void setPerformanceLatency(int performanceLatency) 
- 
setPerformanceBandwidthpublic void setPerformanceBandwidth(int performanceBandwidth) 
- 
setOoBInlinepublic void setOoBInline(boolean ooBInline) 
- 
setDirectBufferpublic void setDirectBuffer(boolean directBuffer) 
- 
setDirectSslBufferpublic void setDirectSslBuffer(boolean directSslBuffer) 
- 
setSoLingerOnpublic void setSoLingerOn(boolean soLingerOn) 
- 
setBufferPoolpublic void setBufferPool(int bufferPool) 
- 
setBufferPoolSizepublic void setBufferPoolSize(int bufferPoolSize) 
- 
setEventCachepublic void setEventCache(int eventCache) 
- 
setAppReadBufSizepublic void setAppReadBufSize(int appReadBufSize) 
- 
setAppWriteBufSizepublic void setAppWriteBufSize(int appWriteBufSize) 
- 
setProcessorCachepublic void setProcessorCache(int processorCache) 
- 
setTimeoutIntervalpublic void setTimeoutInterval(long timeoutInterval) 
- 
setDirectBufferPoolpublic void setDirectBufferPool(int directBufferPool) 
- 
getUnlockTimeoutpublic int getUnlockTimeout()
- 
setUnlockTimeoutpublic void setUnlockTimeout(int unlockTimeout) 
 
-