Package org.apache.mina.transport.socket
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
public class DefaultSocketSessionConfig extends AbstractSocketSessionConfig
A default implementation ofSocketSessionConfig
.- Author:
- Apache MINA Project
-
-
Constructor Summary
Constructors Constructor Description DefaultSocketSessionConfig()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getReceiveBufferSize()
int
getSendBufferSize()
int
getSoLinger()
Please note that enablingSO_LINGER
in Java NIO can result in platform-dependent behavior and unexpected blocking of I/O thread.int
getTrafficClass()
void
init(IoService parent)
Initialize this configuration.boolean
isKeepAlive()
protected boolean
isKeepAliveChanged()
boolean
isOobInline()
protected boolean
isOobInlineChanged()
protected boolean
isReceiveBufferSizeChanged()
boolean
isReuseAddress()
protected boolean
isReuseAddressChanged()
protected boolean
isSendBufferSizeChanged()
protected boolean
isSoLingerChanged()
boolean
isTcpNoDelay()
protected boolean
isTcpNoDelayChanged()
protected boolean
isTrafficClassChanged()
void
setKeepAlive(boolean keepAlive)
void
setOobInline(boolean oobInline)
void
setReceiveBufferSize(int receiveBufferSize)
void
setReuseAddress(boolean reuseAddress)
void
setSendBufferSize(int sendBufferSize)
void
setSoLinger(int soLinger)
Please note that enablingSO_LINGER
in Java NIO can result in platform-dependent behaviour and unexpected blocking of I/O thread.void
setTcpNoDelay(boolean tcpNoDelay)
void
setTrafficClass(int trafficClass)
-
Methods inherited from class org.apache.mina.transport.socket.AbstractSocketSessionConfig
setAll
-
Methods inherited from class org.apache.mina.core.session.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, setWriteTimeout
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.mina.core.session.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 Detail
-
parent
protected IoService parent
-
-
Method Detail
-
init
public void init(IoService parent)
Initialize this configuration.- Parameters:
parent
- The parent IoService.
-
isReuseAddress
public boolean isReuseAddress()
- Returns:
true
if SO_REUSEADDR is enabled.- See Also:
Socket.getReuseAddress()
-
setReuseAddress
public void setReuseAddress(boolean reuseAddress)
- Parameters:
reuseAddress
- Tells if SO_REUSEADDR is enabled or disabled- See Also:
Socket.setReuseAddress(boolean)
-
getReceiveBufferSize
public int getReceiveBufferSize()
- Returns:
- the size of the receive buffer
- See Also:
Socket.getReceiveBufferSize()
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize)
- Parameters:
receiveBufferSize
- The size of the receive buffer- See Also:
Socket.setReceiveBufferSize(int)
-
getSendBufferSize
public int getSendBufferSize()
- Returns:
- the size of the send buffer
- See Also:
Socket.getSendBufferSize()
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize)
- Parameters:
sendBufferSize
- The size of the send buffer- See Also:
Socket.setSendBufferSize(int)
-
getTrafficClass
public int getTrafficClass()
- Returns:
- the traffic class
- See Also:
Socket.getTrafficClass()
-
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:
Socket.setTrafficClass(int)
-
isKeepAlive
public boolean isKeepAlive()
- Returns:
true
ifSO_KEEPALIVE
is enabled.- See Also:
Socket.getKeepAlive()
-
setKeepAlive
public void setKeepAlive(boolean keepAlive)
- Parameters:
keepAlive
- ifSO_KEEPALIVE
is to be enabled- See Also:
Socket.setKeepAlive(boolean)
-
isOobInline
public boolean isOobInline()
- Returns:
true
ifSO_OOBINLINE
is enabled.- See Also:
Socket.getOOBInline()
-
setOobInline
public void setOobInline(boolean oobInline)
- Parameters:
oobInline
- ifSO_OOBINLINE
is to be enabled- See Also:
Socket.setOOBInline(boolean)
-
getSoLinger
public int getSoLinger()
Please note that enablingSO_LINGER
in Java NIO can result in platform-dependent behavior and unexpected blocking of I/O thread.- Returns:
- The value for
SO_LINGER
- See Also:
Socket.getSoLinger()
, Sun Bug Database
-
setSoLinger
public void setSoLinger(int soLinger)
Please note that enablingSO_LINGER
in Java NIO can result in platform-dependent behaviour and unexpected blocking of I/O thread.- Parameters:
soLinger
- Please specify a negative value to disableSO_LINGER
.- See Also:
Socket.setSoLinger(boolean, int)
, Sun Bug Database
-
isTcpNoDelay
public boolean isTcpNoDelay()
- Returns:
true
ifTCP_NODELAY
is enabled.- See Also:
Socket.getTcpNoDelay()
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay)
- Parameters:
tcpNoDelay
-true
ifTCP_NODELAY
is to be enabled- See Also:
Socket.setTcpNoDelay(boolean)
-
isKeepAliveChanged
protected boolean isKeepAliveChanged()
- Overrides:
isKeepAliveChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thekeepAlive
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isOobInlineChanged
protected boolean isOobInlineChanged()
- Overrides:
isOobInlineChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if theoobInline
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isReceiveBufferSizeChanged
protected boolean isReceiveBufferSizeChanged()
- Overrides:
isReceiveBufferSizeChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thereceiveBufferSize
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isReuseAddressChanged
protected boolean isReuseAddressChanged()
- Overrides:
isReuseAddressChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thereuseAddress
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isSendBufferSizeChanged
protected boolean isSendBufferSizeChanged()
- Overrides:
isSendBufferSizeChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thesendBufferSize
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isSoLingerChanged
protected boolean isSoLingerChanged()
- Overrides:
isSoLingerChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thesoLinger
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isTcpNoDelayChanged
protected boolean isTcpNoDelayChanged()
- Overrides:
isTcpNoDelayChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thetcpNoDelay
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
isTrafficClassChanged
protected boolean isTrafficClassChanged()
- Overrides:
isTrafficClassChanged
in classAbstractSocketSessionConfig
- Returns:
true
if and only if thetrafficClass
property 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 returnstrue
to simplify implementation of subclasses, but overriding the default behavior is always encouraged.
-
-