Class SocketOptions
- java.lang.Object
-
- org.apache.logging.log4j.core.net.SocketOptions
-
- All Implemented Interfaces:
Cloneable
,Builder<SocketOptions>
@Plugin(name="SocketOptions", category="Core", printObject=true) public class SocketOptions extends Object implements Builder<SocketOptions>, Cloneable
Holds all socket options settable viaSocket
methods.
-
-
Constructor Summary
Constructors Constructor Description SocketOptions()
-
Method Summary
-
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
-
-
-
-
Method Detail
-
newBuilder
@PluginBuilderFactory public static SocketOptions newBuilder()
Constructs a new builder.- Returns:
- a new builder.
-
apply
public void apply(Socket socket) throws SocketException
Applies the values in this builder to the given socket.- Parameters:
socket
- The target Socket.- Throws:
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 Integer getActualTrafficClass()
- Returns:
- the value to apply to a
Socket
.
-
getPerformancePreferences
public SocketPerformancePreferences getPerformancePreferences()
- Returns:
- this.
-
getRfc1349TrafficClass
public Rfc1349TrafficClass getRfc1349TrafficClass()
- Returns:
- the value to apply to a
Socket
.
-
setKeepAlive
public SocketOptions setKeepAlive(boolean keepAlive)
- Parameters:
keepAlive
- SeeSocket.setKeepAlive(boolean)
.- Returns:
- this.
-
setOobInline
public SocketOptions setOobInline(boolean oobInline)
- Parameters:
oobInline
- SeeSocket.setOOBInline(boolean)
.- Returns:
- this.
-
setPerformancePreferences
public SocketOptions setPerformancePreferences(SocketPerformancePreferences performancePreferences)
- Parameters:
performancePreferences
- SeeSocket.setPerformancePreferences(int, int, int)
.- Returns:
- this.
-
setReceiveBufferSize
public SocketOptions setReceiveBufferSize(int receiveBufferSize)
- Parameters:
receiveBufferSize
- SeeSocket.setReceiveBufferSize(int)
.- Returns:
- this.
-
setReuseAddress
public SocketOptions setReuseAddress(boolean reuseAddress)
- Parameters:
reuseAddress
- SeeSocket.setReuseAddress(boolean)
.- Returns:
- this.
-
setRfc1349TrafficClass
public SocketOptions setRfc1349TrafficClass(Rfc1349TrafficClass trafficClass)
- Parameters:
trafficClass
- SeeSocket.setTrafficClass(int)
.- Returns:
- the value to apply to a
Socket
.
-
setSendBufferSize
public SocketOptions setSendBufferSize(int sendBufferSize)
- Parameters:
sendBufferSize
- SeeSocket.setSendBufferSize(int)
.- Returns:
- this.
-
setSoLinger
public SocketOptions setSoLinger(int soLinger)
- Parameters:
soLinger
- SeeSocket.setSoLinger(boolean, int)
.- Returns:
- this.
-
setSoTimeout
public SocketOptions setSoTimeout(int soTimeout)
- Parameters:
soTimeout
- SeeSocket.setSoTimeout(int)
.- Returns:
- this.
-
setTcpNoDelay
public SocketOptions setTcpNoDelay(boolean tcpNoDelay)
- Parameters:
tcpNoDelay
- SeeSocket.setTcpNoDelay(boolean)
.- Returns:
- this.
-
setTrafficClass
public SocketOptions setTrafficClass(int trafficClass)
- Parameters:
trafficClass
- SeeSocket.setTrafficClass(int)
.- Returns:
- this.
-
-