Class DefaultSocketSessionConfig
java.lang.Object
org.apache.mina.core.session.AbstractIoSessionConfig
org.apache.mina.transport.socket.AbstractSocketSessionConfig
org.apache.mina.transport.socket.DefaultSocketSessionConfig
- All Implemented Interfaces:
IoSessionConfig, SocketSessionConfig
A default implementation of
SocketSessionConfig.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate static final booleanprivate static final booleanprivate static final intprivate static final booleanprivate static final intprivate booleanprivate booleanprivate booleanprotected IoServiceprivate intprivate booleanprivate intprivate intprivate booleanprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintPlease note that enablingSO_LINGERin Java NIO can result in platform-dependent behavior and unexpected blocking of I/O thread.intvoidInitialize this configuration.booleanprotected booleanbooleanprotected booleanprotected booleanbooleanprotected booleanprotected booleanprotected booleanbooleanprotected booleanprotected booleanvoidsetKeepAlive(boolean keepAlive) voidsetOobInline(boolean oobInline) voidsetReceiveBufferSize(int receiveBufferSize) voidsetReuseAddress(boolean reuseAddress) voidsetSendBufferSize(int sendBufferSize) voidsetSoLinger(int soLinger) Please note that enablingSO_LINGERin Java NIO can result in platform-dependent behavior and unexpected blocking of I/O thread.voidsetTcpNoDelay(boolean tcpNoDelay) voidsetTrafficClass(int trafficClass) Methods inherited from class AbstractSocketSessionConfig
setAllMethods inherited from class AbstractIoSessionConfig
getBothIdleTime, getBothIdleTimeInMillis, getIdleTime, getIdleTimeInMillis, getMaxReadBufferSize, getMinReadBufferSize, getReadBufferSize, getReaderIdleTime, getReaderIdleTimeInMillis, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleTime, getWriterIdleTimeInMillis, getWriteTimeout, getWriteTimeoutInMillis, isUseReadOperation, setBothIdleTime, setIdleTime, setMaxReadBufferSize, setMinReadBufferSize, setReadBufferSize, setReaderIdleTime, setThroughputCalculationInterval, setUseReadOperation, setWriterIdleTime, setWriteTimeoutMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IoSessionConfig
getBothIdleTime, getBothIdleTimeInMillis, getIdleTime, getIdleTimeInMillis, getMaxReadBufferSize, getMinReadBufferSize, getReadBufferSize, getReaderIdleTime, getReaderIdleTimeInMillis, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleTime, getWriterIdleTimeInMillis, getWriteTimeout, getWriteTimeoutInMillis, isUseReadOperation, setBothIdleTime, setIdleTime, setMaxReadBufferSize, setMinReadBufferSize, setReadBufferSize, setReaderIdleTime, setThroughputCalculationInterval, setUseReadOperation, setWriterIdleTime, setWriteTimeout
-
Field Details
-
DEFAULT_REUSE_ADDRESS
private static final boolean DEFAULT_REUSE_ADDRESS- See Also:
-
DEFAULT_TRAFFIC_CLASS
private static final int DEFAULT_TRAFFIC_CLASS- See Also:
-
DEFAULT_KEEP_ALIVE
private static final boolean DEFAULT_KEEP_ALIVE- See Also:
-
DEFAULT_OOB_INLINE
private static final boolean DEFAULT_OOB_INLINE- See Also:
-
DEFAULT_SO_LINGER
private static final int DEFAULT_SO_LINGER- See Also:
-
DEFAULT_TCP_NO_DELAY
private static final boolean DEFAULT_TCP_NO_DELAY- See Also:
-
parent
-
defaultReuseAddress
private boolean defaultReuseAddress -
reuseAddress
private boolean reuseAddress -
receiveBufferSize
private int receiveBufferSize -
sendBufferSize
private int sendBufferSize -
trafficClass
private int trafficClass -
keepAlive
private boolean keepAlive -
oobInline
private boolean oobInline -
soLinger
private int soLinger -
tcpNoDelay
private boolean tcpNoDelay
-
-
Constructor Details
-
DefaultSocketSessionConfig
public DefaultSocketSessionConfig()Creates a new instance.
-
-
Method Details
-
init
Initialize this configuration.- Parameters:
parent- The parent IoService.
-
isReuseAddress
public boolean isReuseAddress()- Returns:
trueif SO_REUSEADDR is enabled.- See Also:
-
setReuseAddress
public void setReuseAddress(boolean reuseAddress) - Parameters:
reuseAddress- Tells if SO_REUSEADDR is enabled or disabled- See Also:
-
getReceiveBufferSize
public int getReceiveBufferSize()- Returns:
- the size of the receive buffer
- See Also:
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize) - Parameters:
receiveBufferSize- The size of the receive buffer- See Also:
-
getSendBufferSize
public int getSendBufferSize()- Returns:
- the size of the send buffer
- See Also:
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize) - Parameters:
sendBufferSize- The size of the send buffer- See Also:
-
getTrafficClass
public int getTrafficClass()- Returns:
- the traffic class
- See Also:
-
setTrafficClass
public void setTrafficClass(int trafficClass) - Parameters:
trafficClass- The traffic class to set, one ofIPTOS_LOWCOST(0x02)IPTOS_RELIABILITY(0x04),IPTOS_THROUGHPUT(0x08) orIPTOS_LOWDELAY(0x10)- See Also:
-
isKeepAlive
public boolean isKeepAlive()- Returns:
trueifSO_KEEPALIVEis enabled.- See Also:
-
setKeepAlive
public void setKeepAlive(boolean keepAlive) - Parameters:
keepAlive- ifSO_KEEPALIVEis to be enabled- See Also:
-
isOobInline
public boolean isOobInline()- Returns:
trueifSO_OOBINLINEis enabled.- See Also:
-
setOobInline
public void setOobInline(boolean oobInline) - Parameters:
oobInline- ifSO_OOBINLINEis to be enabled- See Also:
-
getSoLinger
public int getSoLinger()Please note that enablingSO_LINGERin Java NIO can result in platform-dependent behavior and unexpected blocking of I/O thread.- Returns:
- The value for
SO_LINGER - See Also:
-
setSoLinger
public void setSoLinger(int soLinger) Please note that enablingSO_LINGERin Java NIO can result in platform-dependent behavior and unexpected blocking of I/O thread.- Parameters:
soLinger- Please specify a negative value to disableSO_LINGER.- See Also:
-
isTcpNoDelay
public boolean isTcpNoDelay()- Returns:
trueifTCP_NODELAYis enabled.- See Also:
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay) - Parameters:
tcpNoDelay-trueifTCP_NODELAYis to be enabled- See Also:
-
isKeepAliveChanged
protected boolean isKeepAliveChanged()- Overrides:
isKeepAliveChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thekeepAliveproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isOobInlineChanged
protected boolean isOobInlineChanged()- Overrides:
isOobInlineChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if theoobInlineproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isReceiveBufferSizeChanged
protected boolean isReceiveBufferSizeChanged()- Overrides:
isReceiveBufferSizeChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thereceiveBufferSizeproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isReuseAddressChanged
protected boolean isReuseAddressChanged()- Overrides:
isReuseAddressChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thereuseAddressproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isSendBufferSizeChanged
protected boolean isSendBufferSizeChanged()- Overrides:
isSendBufferSizeChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thesendBufferSizeproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isSoLingerChanged
protected boolean isSoLingerChanged()- Overrides:
isSoLingerChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thesoLingerproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isTcpNoDelayChanged
protected boolean isTcpNoDelayChanged()- Overrides:
isTcpNoDelayChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thetcpNoDelayproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isTrafficClassChanged
protected boolean isTrafficClassChanged()- Overrides:
isTrafficClassChangedin classAbstractSocketSessionConfig- Returns:
trueif and only if thetrafficClassproperty has been changed by its setter method. The system call related with the property is made only when this method returnstrue. By default, this method always returnstrueto simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-