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 via
Socket
methods.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Applies the values in this builder to the given socket.build()
Builds the object after all configuration has been set.static SocketOptions
Constructs a new builder.setKeepAlive
(boolean keepAlive) setOobInline
(boolean oobInline) setPerformancePreferences
(SocketPerformancePreferences performancePreferences) setReceiveBufferSize
(int receiveBufferSize) setReuseAddress
(boolean reuseAddress) setRfc1349TrafficClass
(Rfc1349TrafficClass trafficClass) setSendBufferSize
(int sendBufferSize) setSoLinger
(int soLinger) setSoTimeout
(int soTimeout) setTcpNoDelay
(boolean tcpNoDelay) setTrafficClass
(int trafficClass) 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
-
Constructor Details
-
SocketOptions
public SocketOptions()
-
-
Method Details
-
newBuilder
Constructs a new builder.- Returns:
- a new builder.
-
apply
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
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
- Returns:
- the value to apply to a
Socket
.
-
getPerformancePreferences
- Returns:
- this.
-
getReceiveBufferSize
- Returns:
- the value to apply to a
Socket
.
-
getRfc1349TrafficClass
- Returns:
- the value to apply to a
Socket
.
-
getSendBufferSize
- Returns:
- the value to apply to a
Socket
.
-
getSoLinger
- Returns:
- the value to apply to a
Socket
.
-
getSoTimeout
- Returns:
- the value to apply to a
Socket
.
-
getTrafficClass
- Returns:
- the value to apply to a
Socket
.
-
isKeepAlive
- Returns:
- the value to apply to a
Socket
.
-
isOobInline
- Returns:
- the value to apply to a
Socket
.
-
isReuseAddress
- Returns:
- the value to apply to a
Socket
.
-
isTcpNoDelay
- Returns:
- the value to apply to a
Socket
.
-
setKeepAlive
- Parameters:
keepAlive
- SeeSocket.setKeepAlive(boolean)
.- Returns:
- this.
-
setOobInline
- Parameters:
oobInline
- SeeSocket.setOOBInline(boolean)
.- Returns:
- this.
-
setPerformancePreferences
- Parameters:
performancePreferences
- SeeSocket.setPerformancePreferences(int, int, int)
.- Returns:
- this.
-
setReceiveBufferSize
- Parameters:
receiveBufferSize
- SeeSocket.setReceiveBufferSize(int)
.- Returns:
- this.
-
setReuseAddress
- Parameters:
reuseAddress
- SeeSocket.setReuseAddress(boolean)
.- Returns:
- this.
-
setRfc1349TrafficClass
- Parameters:
trafficClass
- SeeSocket.setTrafficClass(int)
.- Returns:
- the value to apply to a
Socket
.
-
setSendBufferSize
- Parameters:
sendBufferSize
- SeeSocket.setSendBufferSize(int)
.- Returns:
- this.
-
setSoLinger
- Parameters:
soLinger
- SeeSocket.setSoLinger(boolean, int)
.- Returns:
- this.
-
setSoTimeout
- Parameters:
soTimeout
- SeeSocket.setSoTimeout(int)
.- Returns:
- this.
-
setTcpNoDelay
- Parameters:
tcpNoDelay
- SeeSocket.setTcpNoDelay(boolean)
.- Returns:
- this.
-
setTrafficClass
- Parameters:
trafficClass
- SeeSocket.setTrafficClass(int)
.- Returns:
- this.
-
toString
-