Class SocketOptions
- java.lang.Object
-
- org.apache.logging.log4j.core.net.SocketOptions
-
- All Implemented Interfaces:
java.lang.Cloneable
,Builder<SocketOptions>
@Plugin(name="SocketOptions", category="Core", printObject=true) public class SocketOptions extends java.lang.Object implements Builder<SocketOptions>, java.lang.Cloneable
Holds all socket options settable viaSocket
methods.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Boolean
keepAlive
private java.lang.Boolean
oobInline
private SocketPerformancePreferences
performancePreferences
private java.lang.Integer
receiveBufferSize
private java.lang.Boolean
reuseAddress
private Rfc1349TrafficClass
rfc1349TrafficClass
private java.lang.Integer
sendBufferSize
private java.lang.Integer
soLinger
private java.lang.Integer
soTimeout
private java.lang.Boolean
tcpNoDelay
private java.lang.Integer
trafficClass
-
Constructor Summary
Constructors Constructor Description SocketOptions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(java.net.Socket socket)
Applies the values in this builder to the given socket.SocketOptions
build()
Builds the object after all configuration has been set.java.lang.Integer
getActualTrafficClass()
SeeSocket.setTrafficClass(int)
.SocketPerformancePreferences
getPerformancePreferences()
SeeSocket.setPerformancePreferences(int, int, int)
.java.lang.Integer
getReceiveBufferSize()
SeeSocket.setReceiveBufferSize(int)
.Rfc1349TrafficClass
getRfc1349TrafficClass()
SeeSocket.setTrafficClass(int)
.java.lang.Integer
getSendBufferSize()
SeeSocket.setSendBufferSize(int)
.java.lang.Integer
getSoLinger()
SeeSocket.setSoLinger(boolean, int)
.java.lang.Integer
getSoTimeout()
SeeSocket.setSoTimeout(int)
.java.lang.Integer
getTrafficClass()
SeeSocket.setTrafficClass(int)
.java.lang.Boolean
isKeepAlive()
SeeSocket.setKeepAlive(boolean)
.java.lang.Boolean
isOobInline()
SeeSocket.setOOBInline(boolean)
.java.lang.Boolean
isReuseAddress()
SeeSocket.setReuseAddress(boolean)
.java.lang.Boolean
isTcpNoDelay()
SeeSocket.setTcpNoDelay(boolean)
.static SocketOptions
newBuilder()
Constructs a new builder.SocketOptions
setKeepAlive(boolean keepAlive)
SeeSocket.setKeepAlive(boolean)
.SocketOptions
setOobInline(boolean oobInline)
SeeSocket.setOOBInline(boolean)
.SocketOptions
setPerformancePreferences(SocketPerformancePreferences performancePreferences)
SeeSocket.setPerformancePreferences(int, int, int)
.SocketOptions
setReceiveBufferSize(int receiveBufferSize)
SeeSocket.setReceiveBufferSize(int)
.SocketOptions
setReuseAddress(boolean reuseAddress)
SeeSocket.setReuseAddress(boolean)
.SocketOptions
setRfc1349TrafficClass(Rfc1349TrafficClass trafficClass)
SeeSocket.setTrafficClass(int)
.SocketOptions
setSendBufferSize(int sendBufferSize)
SeeSocket.setSendBufferSize(int)
.SocketOptions
setSoLinger(int soLinger)
SeeSocket.setSoLinger(boolean, int)
.SocketOptions
setSoTimeout(int soTimeout)
SeeSocket.setSoTimeout(int)
.SocketOptions
setTcpNoDelay(boolean tcpNoDelay)
SeeSocket.setTcpNoDelay(boolean)
.SocketOptions
setTrafficClass(int trafficClass)
SeeSocket.setTrafficClass(int)
.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
-
-
-
Field Detail
-
keepAlive
@PluginBuilderAttribute private java.lang.Boolean keepAlive
-
oobInline
@PluginBuilderAttribute private java.lang.Boolean oobInline
-
performancePreferences
@PluginElement("PerformancePreferences") private SocketPerformancePreferences performancePreferences
-
receiveBufferSize
@PluginBuilderAttribute private java.lang.Integer receiveBufferSize
-
reuseAddress
@PluginBuilderAttribute private java.lang.Boolean reuseAddress
-
rfc1349TrafficClass
@PluginBuilderAttribute private Rfc1349TrafficClass rfc1349TrafficClass
-
sendBufferSize
@PluginBuilderAttribute private java.lang.Integer sendBufferSize
-
soLinger
@PluginBuilderAttribute private java.lang.Integer soLinger
-
soTimeout
@PluginBuilderAttribute private java.lang.Integer soTimeout
-
tcpNoDelay
@PluginBuilderAttribute private java.lang.Boolean tcpNoDelay
-
trafficClass
@PluginBuilderAttribute private java.lang.Integer trafficClass
-
-
Method Detail
-
newBuilder
@PluginBuilderFactory public static SocketOptions newBuilder()
Constructs a new builder.- Returns:
- a new builder.
-
apply
public void apply(java.net.Socket socket) throws java.net.SocketException
Applies the values in this builder to the given socket.- Parameters:
socket
- The target Socket.- Throws:
java.net.SocketException
- if there is an error in the underlying protocol, such as a TCP error.
-
build
public SocketOptions build()
Description copied from interface:Builder
Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
build
in interfaceBuilder<SocketOptions>
- Returns:
- the configured instance.
-
getActualTrafficClass
public java.lang.Integer getActualTrafficClass()
SeeSocket.setTrafficClass(int)
.- Returns:
- the value to apply to a
Socket
.
-
getPerformancePreferences
public SocketPerformancePreferences getPerformancePreferences()
SeeSocket.setPerformancePreferences(int, int, int)
.- Returns:
- this.
-
getReceiveBufferSize
public java.lang.Integer getReceiveBufferSize()
SeeSocket.setReceiveBufferSize(int)
.- Returns:
- the value to apply to a
Socket
.
-
getRfc1349TrafficClass
public Rfc1349TrafficClass getRfc1349TrafficClass()
SeeSocket.setTrafficClass(int)
.- Returns:
- the value to apply to a
Socket
.
-
getSendBufferSize
public java.lang.Integer getSendBufferSize()
SeeSocket.setSendBufferSize(int)
.- Returns:
- the value to apply to a
Socket
.
-
getSoLinger
public java.lang.Integer getSoLinger()
SeeSocket.setSoLinger(boolean, int)
.- Returns:
- the value to apply to a
Socket
.
-
getSoTimeout
public java.lang.Integer getSoTimeout()
SeeSocket.setSoTimeout(int)
.- Returns:
- the value to apply to a
Socket
.
-
getTrafficClass
public java.lang.Integer getTrafficClass()
SeeSocket.setTrafficClass(int)
.- Returns:
- the value to apply to a
Socket
.
-
isKeepAlive
public java.lang.Boolean isKeepAlive()
SeeSocket.setKeepAlive(boolean)
.- Returns:
- the value to apply to a
Socket
.
-
isOobInline
public java.lang.Boolean isOobInline()
SeeSocket.setOOBInline(boolean)
.- Returns:
- the value to apply to a
Socket
.
-
isReuseAddress
public java.lang.Boolean isReuseAddress()
SeeSocket.setReuseAddress(boolean)
.- Returns:
- the value to apply to a
Socket
.
-
isTcpNoDelay
public java.lang.Boolean isTcpNoDelay()
SeeSocket.setTcpNoDelay(boolean)
.- Returns:
- the value to apply to a
Socket
.
-
setKeepAlive
public SocketOptions setKeepAlive(boolean keepAlive)
SeeSocket.setKeepAlive(boolean)
.- Parameters:
keepAlive
- SeeSocket.setKeepAlive(boolean)
.- Returns:
- this.
-
setOobInline
public SocketOptions setOobInline(boolean oobInline)
SeeSocket.setOOBInline(boolean)
.- Parameters:
oobInline
- SeeSocket.setOOBInline(boolean)
.- Returns:
- this.
-
setPerformancePreferences
public SocketOptions setPerformancePreferences(SocketPerformancePreferences performancePreferences)
SeeSocket.setPerformancePreferences(int, int, int)
.- Parameters:
performancePreferences
- SeeSocket.setPerformancePreferences(int, int, int)
.- Returns:
- this.
-
setReceiveBufferSize
public SocketOptions setReceiveBufferSize(int receiveBufferSize)
SeeSocket.setReceiveBufferSize(int)
.- Parameters:
receiveBufferSize
- SeeSocket.setReceiveBufferSize(int)
.- Returns:
- this.
-
setReuseAddress
public SocketOptions setReuseAddress(boolean reuseAddress)
SeeSocket.setReuseAddress(boolean)
.- Parameters:
reuseAddress
- SeeSocket.setReuseAddress(boolean)
.- Returns:
- this.
-
setRfc1349TrafficClass
public SocketOptions setRfc1349TrafficClass(Rfc1349TrafficClass trafficClass)
SeeSocket.setTrafficClass(int)
.- Parameters:
trafficClass
- SeeSocket.setTrafficClass(int)
.- Returns:
- the value to apply to a
Socket
.
-
setSendBufferSize
public SocketOptions setSendBufferSize(int sendBufferSize)
SeeSocket.setSendBufferSize(int)
.- Parameters:
sendBufferSize
- SeeSocket.setSendBufferSize(int)
.- Returns:
- this.
-
setSoLinger
public SocketOptions setSoLinger(int soLinger)
SeeSocket.setSoLinger(boolean, int)
.- Parameters:
soLinger
- SeeSocket.setSoLinger(boolean, int)
.- Returns:
- this.
-
setSoTimeout
public SocketOptions setSoTimeout(int soTimeout)
SeeSocket.setSoTimeout(int)
.- Parameters:
soTimeout
- SeeSocket.setSoTimeout(int)
.- Returns:
- this.
-
setTcpNoDelay
public SocketOptions setTcpNoDelay(boolean tcpNoDelay)
SeeSocket.setTcpNoDelay(boolean)
.- Parameters:
tcpNoDelay
- SeeSocket.setTcpNoDelay(boolean)
.- Returns:
- this.
-
setTrafficClass
public SocketOptions setTrafficClass(int trafficClass)
SeeSocket.setTrafficClass(int)
.- Parameters:
trafficClass
- SeeSocket.setTrafficClass(int)
.- Returns:
- this.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-