org.apache.tomcat.util.net

## Class SocketProperties

- java.lang.Object
- - org.apache.tomcat.util.net.SocketProperties

    public class SocketProperties
    extends Object

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

Author:
  Filip Hanik

### Field Summary

Fields
`protected int` `appReadBufSize` The application read buffer size in bytes.
`protected int` `appWriteBufSize` The application write buffer size in bytes Default value is txBufSize
`protected int` `bufferPool` NioChannel pool size for the endpoint, this value is how many channels -1 means unlimited cached, 0 means no cache Default value is 500
`protected int` `bufferPoolSize` Buffer pool size in bytes to be cached -1 means unlimited, 0 means no cache Default value is 100MB (1024*1024*100 bytes)
`protected boolean` `directBuffer` Enable/disable direct buffers for the network buffers Default value is enabled
`protected int` `eventCache` Enable/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 int` `keyCache` Enable/disable key cache, this bounded cache stores KeyAttachment objects to reduce GC Default is 500 -1 is unlimited 0 is disabled
`protected Boolean` `ooBInline` OOBINLINE option.
`protected Integer` `performanceBandwidth` Performance preferences according to http://docs.oracle.com/javase/1.5.0/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 Integer` `performanceConnectionTime` Performance preferences according to http://docs.oracle.com/javase/1.5.0/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 Integer` `performanceLatency` Performance preferences according to http://docs.oracle.com/javase/1.5.0/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 int` `processorCache` Enable/disable socket processor cache, this bounded cache stores SocketProcessor objects to reduce GC Default is 500 -1 is unlimited 0 is disabled
`protected Integer` `rxBufSize` Socket receive buffer size in bytes (SO_RCVBUF).
`protected Boolean` `soKeepAlive` SO_KEEPALIVE option.
`protected Boolean` `soLingerOn` SO_LINGER option, paired with the `soLingerTime` value.
`protected Integer` `soLingerTime` SO_LINGER option, paired with the `soLingerOn` value.
`protected Boolean` `soReuseAddress` SO_REUSEADDR option.
`protected Integer` `soTimeout` SO_TIMEOUT option. default is 20000.
`protected Boolean` `tcpNoDelay` TCP_NO_DELAY option.
`protected long` `timeoutInterval` The minimum frequency of the timeout interval to avoid excess load from the poller during high traffic
`protected Integer` `txBufSize` Socket send buffer size in bytes (SO_SNDBUF).
`protected int` `unlockTimeout` Timeout in milliseconds for an unlock to take place.

### Constructor Summary

Constructors
Constructor and Description
`SocketProperties()`

### Method Summary

Methods
`int` `getAppReadBufSize()`
`int` `getAppWriteBufSize()`
`int` `getBufferPool()`
`int` `getBufferPoolSize()`
`boolean` `getDirectBuffer()`
`int` `getDirectBufferPool()`
`int` `getEventCache()`
`int` `getKeyCache()`
`boolean` `getOoBInline()`
`int` `getPerformanceBandwidth()`
`int` `getPerformanceConnectionTime()`
`int` `getPerformanceLatency()`
`int` `getProcessorCache()`
`int` `getRxBufSize()`
`boolean` `getSoKeepAlive()`
`boolean` `getSoLingerOn()`
`int` `getSoLingerTime()`
`boolean` `getSoReuseAddress()`
`int` `getSoTimeout()`
`boolean` `getTcpNoDelay()`
`long` `getTimeoutInterval()`
`int` `getTxBufSize()`
`int` `getUnlockTimeout()`
`void` `setAppReadBufSize(int appReadBufSize)`
`void` `setAppWriteBufSize(int appWriteBufSize)`
`void` `setBufferPool(int bufferPool)`
`void` `setBufferPoolSize(int bufferPoolSize)`
`void` `setDirectBuffer(boolean directBuffer)`
`void` `setDirectBufferPool(int directBufferPool)`
`void` `setEventCache(int eventCache)`
`void` `setKeyCache(int keyCache)`
`void` `setOoBInline(boolean ooBInline)`
`void` `setPerformanceBandwidth(int performanceBandwidth)`
`void` `setPerformanceConnectionTime(int performanceConnectionTime)`
`void` `setPerformanceLatency(int performanceLatency)`
`void` `setProcessorCache(int processorCache)`
`void` `setProperties(ServerSocket socket)`
`void` `setProperties(Socket socket)`
`void` `setRxBufSize(int rxBufSize)`
`void` `setSoKeepAlive(boolean soKeepAlive)`
`void` `setSoLingerOn(boolean soLingerOn)`
`void` `setSoLingerTime(int soLingerTime)`
`void` `setSoReuseAddress(boolean soReuseAddress)`
`void` `setSoTimeout(int soTimeout)`
`void` `setTcpNoDelay(boolean tcpNoDelay)`
`void` `setTimeoutInterval(long timeoutInterval)`
`void` `setTxBufSize(int txBufSize)`
`void` `setUnlockTimeout(int unlockTimeout)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### keyCache

    protected int keyCache

Enable/disable key cache, this bounded cache stores KeyAttachment objects to reduce GC Default is 500 -1 is unlimited 0 is disabled

#### processorCache

    protected int processorCache

Enable/disable socket processor cache, this bounded cache stores SocketProcessor objects to reduce GC Default is 500 -1 is unlimited 0 is disabled

#### eventCache

    protected int eventCache

Enable/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.

#### directBuffer

    protected boolean directBuffer

Enable/disable direct buffers for the network buffers Default value is enabled

#### rxBufSize

    protected Integer rxBufSize

Socket receive buffer size in bytes (SO_RCVBUF). JVM default used if not set.

#### txBufSize

    protected Integer txBufSize

Socket send buffer size in bytes (SO_SNDBUF). JVM default used if not set.

#### appReadBufSize

    protected int appReadBufSize

The application read buffer size in bytes. Default value is rxBufSize

#### appWriteBufSize

    protected int appWriteBufSize

The application write buffer size in bytes Default value is txBufSize

#### bufferPool

    protected int bufferPool

NioChannel pool size for the endpoint, this value is how many channels -1 means unlimited cached, 0 means no cache Default value is 500

#### bufferPoolSize

    protected int bufferPoolSize

Buffer pool size in bytes to be cached -1 means unlimited, 0 means no cache Default value is 100MB (1024*1024*100 bytes)

#### tcpNoDelay

    protected Boolean tcpNoDelay

TCP_NO_DELAY option. JVM default used if not set.

#### soKeepAlive

    protected Boolean soKeepAlive

SO_KEEPALIVE option. JVM default used if not set.

#### ooBInline

    protected Boolean ooBInline

OOBINLINE option. JVM default used if not set.

#### soReuseAddress

    protected Boolean soReuseAddress

SO_REUSEADDR option. JVM default used if not set.

#### soLingerOn

    protected Boolean soLingerOn

SO_LINGER option, paired with the `soLingerTime` value. JVM defaults used unless both attributes are set.

#### soLingerTime

    protected Integer soLingerTime

SO_LINGER option, paired with the `soLingerOn` value. JVM defaults used unless both attributes are set.

#### soTimeout

    protected Integer soTimeout

SO_TIMEOUT option. default is 20000.

#### performanceConnectionTime

    protected Integer performanceConnectionTime

Performance preferences according to http://docs.oracle.com/javase/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.

#### performanceLatency

    protected Integer performanceLatency

Performance preferences according to http://docs.oracle.com/javase/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.

#### performanceBandwidth

    protected Integer performanceBandwidth

Performance preferences according to http://docs.oracle.com/javase/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int) All three performance attributes must be set or the JVM defaults will be used.

#### timeoutInterval

    protected long timeoutInterval

The minimum frequency of the timeout interval to avoid excess load from the poller during high traffic

#### unlockTimeout

    protected int unlockTimeout

Timeout in milliseconds for an unlock to take place.

### Constructor Detail

#### SocketProperties

    public SocketProperties()

### Method Detail

#### setProperties

    public void setProperties(Socket socket)
                       throws SocketException

Throws:
  `SocketException`

#### setProperties

    public void setProperties(ServerSocket socket)
                       throws SocketException

Throws:
  `SocketException`

#### getDirectBuffer

    public boolean getDirectBuffer()

#### getOoBInline

    public boolean getOoBInline()

#### getPerformanceBandwidth

    public int getPerformanceBandwidth()

#### getPerformanceConnectionTime

    public int getPerformanceConnectionTime()

#### getPerformanceLatency

    public int getPerformanceLatency()

#### getRxBufSize

    public int getRxBufSize()

#### getSoKeepAlive

    public boolean getSoKeepAlive()

#### getSoLingerOn

    public boolean getSoLingerOn()

#### getSoLingerTime

    public int getSoLingerTime()

#### getSoReuseAddress

    public boolean getSoReuseAddress()

#### getSoTimeout

    public int getSoTimeout()

#### getTcpNoDelay

    public boolean getTcpNoDelay()

#### getTxBufSize

    public int getTxBufSize()

#### getBufferPool

    public int getBufferPool()

#### getBufferPoolSize

    public int getBufferPoolSize()

#### getEventCache

    public int getEventCache()

#### getKeyCache

    public int getKeyCache()

#### getAppReadBufSize

    public int getAppReadBufSize()

#### getAppWriteBufSize

    public int getAppWriteBufSize()

#### getProcessorCache

    public int getProcessorCache()

#### getTimeoutInterval

    public long getTimeoutInterval()

#### getDirectBufferPool

    public int getDirectBufferPool()

#### setPerformanceConnectionTime

    public void setPerformanceConnectionTime(int performanceConnectionTime)

#### setTxBufSize

    public void setTxBufSize(int txBufSize)

#### setTcpNoDelay

    public void setTcpNoDelay(boolean tcpNoDelay)

#### setSoTimeout

    public void setSoTimeout(int soTimeout)

#### setSoReuseAddress

    public void setSoReuseAddress(boolean soReuseAddress)

#### setSoLingerTime

    public void setSoLingerTime(int soLingerTime)

#### setSoKeepAlive

    public void setSoKeepAlive(boolean soKeepAlive)

#### setRxBufSize

    public void setRxBufSize(int rxBufSize)

#### setPerformanceLatency

    public void setPerformanceLatency(int performanceLatency)

#### setPerformanceBandwidth

    public void setPerformanceBandwidth(int performanceBandwidth)

#### setOoBInline

    public void setOoBInline(boolean ooBInline)

#### setDirectBuffer

    public void setDirectBuffer(boolean directBuffer)

#### setSoLingerOn

    public void setSoLingerOn(boolean soLingerOn)

#### setBufferPool

    public void setBufferPool(int bufferPool)

#### setBufferPoolSize

    public void setBufferPoolSize(int bufferPoolSize)

#### setEventCache

    public void setEventCache(int eventCache)

#### setKeyCache

    public void setKeyCache(int keyCache)

#### setAppReadBufSize

    public void setAppReadBufSize(int appReadBufSize)

#### setAppWriteBufSize

    public void setAppWriteBufSize(int appWriteBufSize)

#### setProcessorCache

    public void setProcessorCache(int processorCache)

#### setTimeoutInterval

    public void setTimeoutInterval(long timeoutInterval)

#### setDirectBufferPool

    public void setDirectBufferPool(int directBufferPool)

#### getUnlockTimeout

    public int getUnlockTimeout()

#### setUnlockTimeout

    public void setUnlockTimeout(int unlockTimeout)