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 viaSocketmethods.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.BooleankeepAliveprivate java.lang.BooleanoobInlineprivate SocketPerformancePreferencesperformancePreferencesprivate java.lang.IntegerreceiveBufferSizeprivate java.lang.BooleanreuseAddressprivate Rfc1349TrafficClassrfc1349TrafficClassprivate java.lang.IntegersendBufferSizeprivate java.lang.IntegersoLingerprivate java.lang.IntegersoTimeoutprivate java.lang.BooleantcpNoDelayprivate java.lang.IntegertrafficClass
-
Constructor Summary
Constructors Constructor Description SocketOptions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(java.net.Socket socket)Applies the values in this builder to the given socket.SocketOptionsbuild()Builds the object after all configuration has been set.java.lang.IntegergetActualTrafficClass()SeeSocket.setTrafficClass(int).SocketPerformancePreferencesgetPerformancePreferences()SeeSocket.setPerformancePreferences(int, int, int).java.lang.IntegergetReceiveBufferSize()SeeSocket.setReceiveBufferSize(int).Rfc1349TrafficClassgetRfc1349TrafficClass()SeeSocket.setTrafficClass(int).java.lang.IntegergetSendBufferSize()SeeSocket.setSendBufferSize(int).java.lang.IntegergetSoLinger()SeeSocket.setSoLinger(boolean, int).java.lang.IntegergetSoTimeout()SeeSocket.setSoTimeout(int).java.lang.IntegergetTrafficClass()SeeSocket.setTrafficClass(int).java.lang.BooleanisKeepAlive()SeeSocket.setKeepAlive(boolean).java.lang.BooleanisOobInline()SeeSocket.setOOBInline(boolean).java.lang.BooleanisReuseAddress()SeeSocket.setReuseAddress(boolean).java.lang.BooleanisTcpNoDelay()SeeSocket.setTcpNoDelay(boolean).static SocketOptionsnewBuilder()Constructs a new builder.SocketOptionssetKeepAlive(boolean keepAlive)SeeSocket.setKeepAlive(boolean).SocketOptionssetOobInline(boolean oobInline)SeeSocket.setOOBInline(boolean).SocketOptionssetPerformancePreferences(SocketPerformancePreferences performancePreferences)SeeSocket.setPerformancePreferences(int, int, int).SocketOptionssetReceiveBufferSize(int receiveBufferSize)SeeSocket.setReceiveBufferSize(int).SocketOptionssetReuseAddress(boolean reuseAddress)SeeSocket.setReuseAddress(boolean).SocketOptionssetRfc1349TrafficClass(Rfc1349TrafficClass trafficClass)SeeSocket.setTrafficClass(int).SocketOptionssetSendBufferSize(int sendBufferSize)SeeSocket.setSendBufferSize(int).SocketOptionssetSoLinger(int soLinger)SeeSocket.setSoLinger(boolean, int).SocketOptionssetSoTimeout(int soTimeout)SeeSocket.setSoTimeout(int).SocketOptionssetTcpNoDelay(boolean tcpNoDelay)SeeSocket.setTcpNoDelay(boolean).SocketOptionssetTrafficClass(int trafficClass)SeeSocket.setTrafficClass(int).java.lang.StringtoString()-
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.SocketExceptionApplies 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:BuilderBuilds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
buildin 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:
toStringin classjava.lang.Object
-
-