- java.lang.Object
-
- swim.io.TcpSettings
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
keepAlive
protected boolean
noDelay
protected int
readBufferSize
protected int
receiveBufferSize
protected int
sendBufferSize
protected int
writeBufferSize
-
Constructor Summary
Constructors Constructor Description TcpSettings(boolean keepAlive, boolean noDelay, int receiveBufferSize, int sendBufferSize, int readBufferSize, int writeBufferSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canEqual(Object other)
Returnstrue
if theseTcpSettings
can possibly equal someother
object.void
configure(Socket socket)
Configures thesocket
with theseTcpSettings
.protected TcpSettings
copy(boolean keepAlive, boolean noDelay, int receiveBufferSize, int sendBufferSize, int readBufferSize, int writeBufferSize)
Returns a newTcpSettings
instance with the given options.<T> Output<T>
debug(Output<T> output)
Writes a developer readable, debug-formatted string representation of this object tooutput
.boolean
equals(Object other)
static Form<TcpSettings>
form()
Returns the structuralForm
ofTcpSettings
.int
hashCode()
boolean
keepAlive()
Returnstrue
if TCP should be configured with theSO_KEEPALIVE
socket option to send keepalive probes to prevent idle connections from timing out.TcpSettings
keepAlive(boolean keepAlive)
Returns a copy of theseTcpSettings
configured with the givenkeepAlive
value for theSO_KEEPALIVE
socket option.boolean
noDelay()
Returnstrue
if TCP should be configured with theTCP_NODELAY
socket option to disable Nagle's algorithm.TcpSettings
noDelay(boolean noDelay)
Returns a copy of theseTcpSettings
configured with the givennoDelay
value for theTCP_NODELAY
socket option.int
readBufferSize()
Returns the size in bytes of the per-socket userspace buffers into which data is received.TcpSettings
readBufferSize(int readBufferSize)
Returns a copy of theseTcpSettings
configured with the givenreadBufferSize
for per-socket userspace read buffers.int
receiveBufferSize()
Returns the value of theSO_RCVBUF
socket option with which TCP should be configured to control the size of receive buffers.TcpSettings
receiveBufferSize(int receiveBufferSize)
Returns a copy of theseTcpSettings
configured with the givenreceiveBufferSize
value for theSO_RCVBUF
socket option.int
sendBufferSize()
Returns the value of theSO_SNDBUF
socket option with which TCP should be configured to control the size of send buffers.TcpSettings
sendBufferSize(int sendBufferSize)
Returns a copy of theseTcpSettings
configured with the givensendBufferSize
value for theSO_SNDBUF
socket option.static TcpSettings
standard()
Returns the defaultTcpSettings
instance.String
toString()
Value
toValue()
Returns a structuralValue
representing theseTcpSettings
.int
writeBufferSize()
Returns the size in bytes of the per-socket userspace buffers from which data is sent.TcpSettings
writeBufferSize(int writeBufferSize)
Returns a copy of theseTcpSettings
configured with the givenwriteBufferSize
for per-socket userspace write buffers.
-
-
-
Field Detail
-
keepAlive
protected final boolean keepAlive
-
noDelay
protected final boolean noDelay
-
receiveBufferSize
protected final int receiveBufferSize
-
sendBufferSize
protected final int sendBufferSize
-
readBufferSize
protected final int readBufferSize
-
writeBufferSize
protected final int writeBufferSize
-
-
Method Detail
-
keepAlive
public final boolean keepAlive()
Returnstrue
if TCP should be configured with theSO_KEEPALIVE
socket option to send keepalive probes to prevent idle connections from timing out.
-
keepAlive
public TcpSettings keepAlive(boolean keepAlive)
Returns a copy of theseTcpSettings
configured with the givenkeepAlive
value for theSO_KEEPALIVE
socket option.
-
noDelay
public final boolean noDelay()
Returnstrue
if TCP should be configured with theTCP_NODELAY
socket option to disable Nagle's algorithm.
-
noDelay
public TcpSettings noDelay(boolean noDelay)
Returns a copy of theseTcpSettings
configured with the givennoDelay
value for theTCP_NODELAY
socket option.
-
receiveBufferSize
public final int receiveBufferSize()
Returns the value of theSO_RCVBUF
socket option with which TCP should be configured to control the size of receive buffers.
-
receiveBufferSize
public TcpSettings receiveBufferSize(int receiveBufferSize)
Returns a copy of theseTcpSettings
configured with the givenreceiveBufferSize
value for theSO_RCVBUF
socket option.
-
sendBufferSize
public final int sendBufferSize()
Returns the value of theSO_SNDBUF
socket option with which TCP should be configured to control the size of send buffers.
-
sendBufferSize
public TcpSettings sendBufferSize(int sendBufferSize)
Returns a copy of theseTcpSettings
configured with the givensendBufferSize
value for theSO_SNDBUF
socket option.
-
readBufferSize
public final int readBufferSize()
Returns the size in bytes of the per-socket userspace buffers into which data is received.
-
readBufferSize
public TcpSettings readBufferSize(int readBufferSize)
Returns a copy of theseTcpSettings
configured with the givenreadBufferSize
for per-socket userspace read buffers.
-
writeBufferSize
public final int writeBufferSize()
Returns the size in bytes of the per-socket userspace buffers from which data is sent.
-
writeBufferSize
public TcpSettings writeBufferSize(int writeBufferSize)
Returns a copy of theseTcpSettings
configured with the givenwriteBufferSize
for per-socket userspace write buffers.
-
copy
protected TcpSettings copy(boolean keepAlive, boolean noDelay, int receiveBufferSize, int sendBufferSize, int readBufferSize, int writeBufferSize)
Returns a newTcpSettings
instance with the given options. Subclasses may override this method to ensure the proper class is instantiated when updating settings.
-
configure
public void configure(Socket socket) throws SocketException
Configures thesocket
with theseTcpSettings
.- Throws:
SocketException
-
toValue
public Value toValue()
Returns a structuralValue
representing theseTcpSettings
.
-
canEqual
public boolean canEqual(Object other)
Returnstrue
if theseTcpSettings
can possibly equal someother
object.
-
debug
public <T> Output<T> debug(Output<T> output)
Description copied from interface:Debug
Writes a developer readable, debug-formatted string representation of this object tooutput
.
-
standard
public static TcpSettings standard()
Returns the defaultTcpSettings
instance.
-
form
@Kind public static Form<TcpSettings> form()
Returns the structuralForm
ofTcpSettings
.
-
-