Top Description Inners Fields Constructors Methods
org.apache.http.config

public Class SocketConfig

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Annotations
@Contract
threading:IMMUTABLE
Imports
org.apache.http.annotation.ThreadingBehavior, .Contract, org.apache.http.util.Args

Socket configuration.
Since
4.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final int
public static final SocketConfig
private final int
private final int
private final boolean
private final int
private final boolean
private final int
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
SocketConfig(final int soTimeout, final boolean soReuseAddress, final int soLinger, final boolean soKeepAlive, final boolean tcpNoDelay, final int sndBufSize, final int rcvBufSize, final int backlogSize)

Method Summary

Modifier and TypeMethod and Description
protected SocketConfig
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public static SocketConfig.Builder
copy(final SocketConfig config)

public static SocketConfig.Builder
public int

Returns:

the maximum queue length for incoming connection indications
getBacklogSize
()

Determines the maximum queue length for incoming connection indications (a request to connect) also known as server socket backlog.

public int

Returns:

the default value of the java.net.SocketOptions#SO_RCVBUF parameter.
getRcvBufSize
()

Determines the default value of the java.net.SocketOptions#SO_RCVBUF parameter for newly created sockets.

public int

Returns:

the default value of the java.net.SocketOptions#SO_SNDBUF parameter.
getSndBufSize
()

Determines the default value of the java.net.SocketOptions#SO_SNDBUF parameter for newly created sockets.

public int

Returns:

the default value of the java.net.SocketOptions#SO_LINGER parameter.
getSoLinger
()

Determines the default value of the java.net.SocketOptions#SO_LINGER parameter for newly created sockets.

public int

Returns:

the default socket timeout value for non-blocking I/O operations.
getSoTimeout
()

Determines the default socket timeout value for non-blocking I/O operations.

public boolean

Returns:

the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter.
isSoKeepAlive
()

Determines the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter for newly created sockets.

public boolean

Returns:

the default value of the java.net.SocketOptions#SO_REUSEADDR parameter.
isSoReuseAddress
()

Determines the default value of the java.net.SocketOptions#SO_REUSEADDR parameter for newly created sockets.

public boolean

Returns:

the default value of the java.net.SocketOptions#TCP_NODELAY parameter.
isTcpNoDelay
()

Determines the default value of the java.net.SocketOptions#TCP_NODELAY parameter for newly created sockets.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

backlogSizeback to summary
private final int backlogSize
DEFAULTback to summary
public static final SocketConfig DEFAULT
rcvBufSizeback to summary
private final int rcvBufSize
sndBufSizeback to summary
private final int sndBufSize
soKeepAliveback to summary
private final boolean soKeepAlive
soLingerback to summary
private final int soLinger
soReuseAddressback to summary
private final boolean soReuseAddress
soTimeoutback to summary
private final int soTimeout
tcpNoDelayback to summary
private final boolean tcpNoDelay

Constructor Detail

SocketConfigback to summary
pack-priv SocketConfig(final int soTimeout, final boolean soReuseAddress, final int soLinger, final boolean soKeepAlive, final boolean tcpNoDelay, final int sndBufSize, final int rcvBufSize, final int backlogSize)

Method Detail

cloneback to summary
protected SocketConfig clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:SocketConfig

a clone of this instance.

Annotations
@Override
Exceptions
CloneNotSupportedException:
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
copyback to summary
public static SocketConfig.Builder copy(final SocketConfig config)
customback to summary
public static SocketConfig.Builder custom()
getBacklogSizeback to summary
public int getBacklogSize()

Determines the maximum queue length for incoming connection indications (a request to connect) also known as server socket backlog.

Default: 0 (system default)

Returns:int

the maximum queue length for incoming connection indications

Since
4.4
getRcvBufSizeback to summary
public int getRcvBufSize()

Determines the default value of the java.net.SocketOptions#SO_RCVBUF parameter for newly created sockets.

Default: 0 (system default)

Returns:int

the default value of the java.net.SocketOptions#SO_RCVBUF parameter.

Since
4.4
See Also
java.net.SocketOptions#SO_RCVBUF
getSndBufSizeback to summary
public int getSndBufSize()

Determines the default value of the java.net.SocketOptions#SO_SNDBUF parameter for newly created sockets.

Default: 0 (system default)

Returns:int

the default value of the java.net.SocketOptions#SO_SNDBUF parameter.

Since
4.4
See Also
java.net.SocketOptions#SO_SNDBUF
getSoLingerback to summary
public int getSoLinger()

Determines the default value of the java.net.SocketOptions#SO_LINGER parameter for newly created sockets.

Default: -1

Returns:int

the default value of the java.net.SocketOptions#SO_LINGER parameter.

See Also
java.net.SocketOptions#SO_LINGER
getSoTimeoutback to summary
public int getSoTimeout()

Determines the default socket timeout value for non-blocking I/O operations.

Default: 0 (no timeout)

Returns:int

the default socket timeout value for non-blocking I/O operations.

See Also
java.net.SocketOptions#SO_TIMEOUT
isSoKeepAliveback to summary
public boolean isSoKeepAlive()

Determines the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter for newly created sockets.

Default: false

Returns:boolean

the default value of the java.net.SocketOptions#SO_KEEPALIVE parameter.

See Also
java.net.SocketOptions#SO_KEEPALIVE
isSoReuseAddressback to summary
public boolean isSoReuseAddress()

Determines the default value of the java.net.SocketOptions#SO_REUSEADDR parameter for newly created sockets.

Default: false

Returns:boolean

the default value of the java.net.SocketOptions#SO_REUSEADDR parameter.

See Also
java.net.SocketOptions#SO_REUSEADDR
isTcpNoDelayback to summary
public boolean isTcpNoDelay()

Determines the default value of the java.net.SocketOptions#TCP_NODELAY parameter for newly created sockets.

Default: true

Returns:boolean

the default value of the java.net.SocketOptions#TCP_NODELAY parameter.

See Also
java.net.SocketOptions#TCP_NODELAY
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.apache.http.config back to summary

public Class SocketConfig.Builder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
private int
private boolean
private int
private boolean
private int
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public SocketConfig
public SocketConfig.Builder
setBacklogSize(final int backlogSize)

public SocketConfig.Builder
setRcvBufSize(final int rcvBufSize)

public SocketConfig.Builder
setSndBufSize(final int sndBufSize)

public SocketConfig.Builder
setSoKeepAlive(final boolean soKeepAlive)

public SocketConfig.Builder
setSoLinger(final int soLinger)

public SocketConfig.Builder
setSoReuseAddress(final boolean soReuseAddress)

public SocketConfig.Builder
setSoTimeout(final int soTimeout)

public SocketConfig.Builder
setTcpNoDelay(final boolean tcpNoDelay)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backlogSizeback to summary
private int backlogSize
rcvBufSizeback to summary
private int rcvBufSize
sndBufSizeback to summary
private int sndBufSize
soKeepAliveback to summary
private boolean soKeepAlive
soLingerback to summary
private int soLinger
soReuseAddressback to summary
private boolean soReuseAddress
soTimeoutback to summary
private int soTimeout
tcpNoDelayback to summary
private boolean tcpNoDelay

Constructor Detail

Builderback to summary
pack-priv Builder()

Method Detail

buildback to summary
public SocketConfig build()
setBacklogSizeback to summary
public SocketConfig.Builder setBacklogSize(final int backlogSize)
Since
4.4
setRcvBufSizeback to summary
public SocketConfig.Builder setRcvBufSize(final int rcvBufSize)
Since
4.4
setSndBufSizeback to summary
public SocketConfig.Builder setSndBufSize(final int sndBufSize)
Since
4.4
setSoKeepAliveback to summary
public SocketConfig.Builder setSoKeepAlive(final boolean soKeepAlive)
setSoLingerback to summary
public SocketConfig.Builder setSoLinger(final int soLinger)
setSoReuseAddressback to summary
public SocketConfig.Builder setSoReuseAddress(final boolean soReuseAddress)
setSoTimeoutback to summary
public SocketConfig.Builder setSoTimeout(final int soTimeout)
setTcpNoDelayback to summary
public SocketConfig.Builder setTcpNoDelay(final boolean tcpNoDelay)