Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- load(String)
- getStatistics()
- withClientSocketFactory(ClientSocketFactory)
- setName(String)
- setDebug(boolean)
- setTrace(boolean)
- setListenAddress(String)
- setPublicAddress(String)
- setReceiveBufferSize(int)
- setSendBufferSize(int)
- setSoTimeOut(int)
- setConnectTimeOut(int)
- setBackLog(int)
- setKeepAlive(Boolean)
- setTcpNoDelay(Boolean)
- setReuseAddress(Boolean)
- setInterruptible(boolean)
- setPrivilegedLocalPort(boolean)
- setTCPCongestion(String)
- setSOMaxPacingRate(Integer)
- setSOMaxPacingRate(ByteSize)
- setTCPMaxSegment(Integer)
- setTCPTimeStamp(Boolean)
- setTCPWindowClamp(Integer)
- setTCPKeepAliveTime(Integer)
- setTCPKeepAliveInterval(Integer)
- setTCPKeepAliveProbes(Integer)
- setTCPLinger(Boolean, Integer)
- setTCPUserTimeout(Integer)
- setTCPQuickAck(Boolean)
- setTCPOptions(Socket)
- setHost(String)
- setPort(int)
- setServerPort(int)
- getName()
- getTrace()
- getListenAddress()
- getPublicAddress()
- getReceiveBufferSize()
- getSendBufferSize()
- getSOTimeOut()
- getConnectTimeOut()
- getBackLog()
- getKeepAlive()
- getTcpNoDelay()
- getReuseAddress()
- getInterruptible()
- getPrivilegedLocalPort()
- getHost()
- getHost(String)
- getPort()
- getServerPort()
- getPort(int)
- getSocket()
- getSocket(SocketFactory)
- getSocket(int)
- getSocket(SocketFactory, int)
- getSocket(String, int)
- getSocket(SocketFactory, String, int)
- getSocket(String, int, int)
- getSocket(SocketFactory, String, int, int)
- getSocket(ServerSocket)
- configureConnectedSocket(Socket)
- getServerSocket()
- getServerSocket(int)
- getServerSocket(ServerSocketFactory, int)
- isCurrentRMIServerThreadSocketAlive()
- getPublicAddress(String)
- getLocalAddress()
- configToString()
- configToString(Socket)
- configToString(ServerSocket)
- getSocketFactory()
- getSSLSocketFactory(String, boolean)
- getBlindlyTrustingSSLContext(String)
Class SocketConfig
java.lang.Object
ecmwf.common.rmi.SocketConfig
- Direct Known Subclasses:
RMIClientSocketFactory
,RMIServerSocketFactory
,RMISSLServerSocketFactory
,RMISSLSocketFactory
The Class SocketConfig.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Instantiates a new socket configuration.SocketConfig
(ClientSocketStatistics statistics, String name) Instantiates a new socket config.SocketConfig
(ClientSocketStatistics statistics, String name, boolean debug) Instantiates a new socket config.SocketConfig
(String name) Instantiates a new socket config. -
Method Summary
Modifier and TypeMethodDescriptionConfig to string.configToString
(ServerSocket socket) Config to string.configToString
(Socket socket) Config to string.protected void
configureConnectedSocket
(Socket socket) Configure a connected socket.int
Gets the back log.static SSLContext
getBlindlyTrustingSSLContext
(String protocol) Gets the blindly trusting SSL context.int
Gets the connect time out.getHost()
Gets the host.Gets the host.Gets the interruptible.Gets the keep alive.Gets the listen address.static final String
Gets the local address.getName()
Gets the name.int
getPort()
Gets the port.int
getPort
(int defaultPort) Gets the port.boolean
Gets the privileged local port.Gets the public address.static final String
getPublicAddress
(String name) Gets the public address.int
Gets the receive buffer size.Gets the reuse address.int
Gets the sends the buffer size.int
Gets the server port.Gets the server socket.getServerSocket
(int port) Gets the server socket.getServerSocket
(ServerSocketFactory factory, int port) Gets the server socket.Gets the socket.getSocket
(int localPort) Gets the socket.Gets the socket.Gets the socket.getSocket
(ServerSocket serverSocket) Gets the socket.getSocket
(SocketFactory factory) Gets the socket.getSocket
(SocketFactory factory, int localPort) Gets the socket.getSocket
(SocketFactory factory, String host, int port) Gets the socket.getSocket
(SocketFactory factory, String host, int port, int localPort) Gets the socket.Gets the socket factory.int
Gets the SO time out.getSSLSocketFactory
(String protocol, boolean sslValidation) Gets the SSL socket factory.protected ClientSocketStatistics
Gets the statistics.Gets the tcp no delay.boolean
getTrace()
Gets the trace.static final boolean
Checks if is current rmi server thread socket alive.protected void
Load.void
setBackLog
(int backLog) Sets the back log.void
setConnectTimeOut
(int timeOut) Sets the connect time out.void
setDebug
(boolean debug) Sets the debug.void
Sets the host.void
setInterruptible
(boolean interruptible) Sets the interruptible.void
setKeepAlive
(Boolean keepAlive) Sets the keep alive.void
setListenAddress
(String listenAddress) Sets the listen address.void
Sets the name.void
setPort
(int port) Sets the port.void
setPrivilegedLocalPort
(boolean privilegedLocalPort) Sets the privileged local port.void
setPublicAddress
(String publicAddress) Sets the public address.void
setReceiveBufferSize
(int receiveBufferSize) Sets the receive buffer size.void
setReuseAddress
(Boolean reuseAddress) Sets the reuse address.void
setSendBufferSize
(int sendBufferSize) Sets the sends the buffer size.void
setServerPort
(int serverPort) Sets the server port.void
setSOMaxPacingRate
(ByteSize soMaxPacingRate) Set a SO option.void
setSOMaxPacingRate
(Integer soMaxPacingRate) Set a SO option.void
setSoTimeOut
(int timeOut) Sets the so time out.void
setTCPCongestion
(String tcpCongestion) Set a TCP option.void
setTCPKeepAliveInterval
(Integer tcpKeepAliveInterval) Set a TCP option.void
setTCPKeepAliveProbes
(Integer tcpKeepAliveProbes) Set a TCP option.void
setTCPKeepAliveTime
(Integer tcpKeepAliveTime) Set a TCP option.void
setTCPLinger
(Boolean tcpLingerEnable, Integer tcpLingerTime) Controls the behavior of a socket when it is closed and there is unsent data.void
setTCPMaxSegment
(Integer tcpMaxSegment) Set a TCP option.void
setTcpNoDelay
(Boolean tcpNoDelay) Sets the tcp no delay.void
setTCPOptions
(Socket socket) Sets the required socket or serverSocket options.void
setTCPQuickAck
(Boolean tcpQuickAck) Controls whether the TCP stack should quickly acknowledge incoming data.void
setTCPTimeStamp
(Boolean tcpTimeStamp) Set a TCP option.void
setTCPUserTimeout
(Integer tcpUserTimeout) Provides a way to control the timeout for unacknowledged data on a TCP connection.void
setTCPWindowClamp
(Integer tcpWindowClamp) Set a TCP option.void
setTrace
(boolean trace) Sets the trace.protected SocketConfig
withClientSocketFactory
(ClientSocketFactory clientSocketFactory) With client socket factory.
-
Field Details
-
Constructor Details
-
SocketConfig
protected SocketConfig()Instantiates a new socket configuration. -
SocketConfig
-
SocketConfig
Instantiates a new socket config.- Parameters:
statistics
- the statisticsname
- the name
-
SocketConfig
Instantiates a new socket config.- Parameters:
statistics
- the statisticsname
- the namedebug
- the debug
-
-
Method Details
-
load
-
getStatistics
-
withClientSocketFactory
With client socket factory.- Parameters:
clientSocketFactory
- the client socket factory- Returns:
- the socket config
-
setName
-
setDebug
public void setDebug(boolean debug) Sets the debug.- Parameters:
debug
- the new debug
-
setTrace
public void setTrace(boolean trace) Sets the trace.- Parameters:
trace
- the new trace
-
setListenAddress
Sets the listen address.- Parameters:
listenAddress
- the new listen address
-
setPublicAddress
Sets the public address.- Parameters:
publicAddress
- the new public address
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize) Sets the receive buffer size.- Parameters:
receiveBufferSize
- the new receive buffer size
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize) Sets the sends the buffer size.- Parameters:
sendBufferSize
- the new sends the buffer size
-
setSoTimeOut
public void setSoTimeOut(int timeOut) Sets the so time out.- Parameters:
timeOut
- the new so time out
-
setConnectTimeOut
public void setConnectTimeOut(int timeOut) Sets the connect time out.- Parameters:
timeOut
- the new connect time out
-
setBackLog
public void setBackLog(int backLog) Sets the back log.- Parameters:
backLog
- the new back log
-
setKeepAlive
Sets the keep alive.- Parameters:
keepAlive
- the new keep alive
-
setTcpNoDelay
Sets the tcp no delay.- Parameters:
tcpNoDelay
- the new tcp no delay
-
setReuseAddress
Sets the reuse address.- Parameters:
reuseAddress
- the new reuse address
-
setInterruptible
public void setInterruptible(boolean interruptible) Sets the interruptible.- Parameters:
interruptible
- the new interruptible
-
setPrivilegedLocalPort
public void setPrivilegedLocalPort(boolean privilegedLocalPort) Sets the privileged local port.- Parameters:
privilegedLocalPort
- the new privileged local port
-
setTCPCongestion
Set a TCP option.- Parameters:
tcpCongestion
- the TCP congestion algorithm name
-
setSOMaxPacingRate
Set a SO option.- Parameters:
soMaxPacingRate
- set the maximum transmit rate in bytes per second for the socket.
-
setSOMaxPacingRate
Set a SO option.- Parameters:
soMaxPacingRate
- set the maximum transmit rate in bytes per second for the socket.
-
setTCPMaxSegment
Set a TCP option.- Parameters:
tcpMaxSegment
- maximum amount of data that can be sent in a single TCP segment.
-
setTCPTimeStamp
Set a TCP option.- Parameters:
tcpTimeStamp
- enables or disables the use of timestamps in TCP packets
-
setTCPWindowClamp
Set a TCP option.- Parameters:
tcpWindowClamp
- bound the size of the advertised window to this value
-
setTCPKeepAliveTime
Set a TCP option.- Parameters:
tcpKeepAliveTime
- the interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further
-
setTCPKeepAliveInterval
Set a TCP option.- Parameters:
tcpKeepAliveInterval
- the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
-
setTCPKeepAliveProbes
Set a TCP option.- Parameters:
tcpKeepAliveProbes
- the number of unacknowledged probes to send before considering the connection dead and notifying the application layer
-
setTCPLinger
Controls the behavior of a socket when it is closed and there is unsent data. It specifies whether the socket should linger for a specified amount of time before closing. The TCP_LINGER option is often used to ensure that all data is sent before the socket is closed.- Parameters:
tcpLingerEnable
- the tcp linger enabletcpLingerTime
- the amount of time, in seconds, the socket should linger before closing
-
setTCPUserTimeout
Provides a way to control the timeout for unacknowledged data on a TCP connection.- Parameters:
tcpUserTimeout
- maximum amount of time, in milliseconds, that transmitted data may remain unacknowledged before an error is returned
-
setTCPQuickAck
Controls whether the TCP stack should quickly acknowledge incoming data.- Parameters:
tcpQuickAck
- when enabled, the TCP stack sends immediate acknowledgment for incoming data without waiting for the delayed acknowledgment timer.
-
setTCPOptions
Sets the required socket or serverSocket options.- Parameters:
socket
- the new TCP options- Throws:
IOException
- Signals that an I/O exception has occurred.
-
setHost
-
setPort
public void setPort(int port) Sets the port.- Parameters:
port
- the new port
-
setServerPort
public void setServerPort(int serverPort) Sets the server port.- Parameters:
serverPort
- the new server port
-
getName
-
getTrace
public boolean getTrace()Gets the trace.- Returns:
- the trace
-
getListenAddress
-
getPublicAddress
-
getReceiveBufferSize
public int getReceiveBufferSize()Gets the receive buffer size.- Returns:
- the receive buffer size
-
getSendBufferSize
public int getSendBufferSize()Gets the sends the buffer size.- Returns:
- the sends the buffer size
-
getSOTimeOut
public int getSOTimeOut()Gets the SO time out.- Returns:
- the SO time out
-
getConnectTimeOut
public int getConnectTimeOut()Gets the connect time out.- Returns:
- the connect time out
-
getBackLog
public int getBackLog()Gets the back log.- Returns:
- the back log
-
getKeepAlive
-
getTcpNoDelay
-
getReuseAddress
-
getInterruptible
-
getPrivilegedLocalPort
public boolean getPrivilegedLocalPort()Gets the privileged local port.- Returns:
- the privileged local port
-
getHost
-
getHost
-
getPort
public int getPort()Gets the port.- Returns:
- the port
-
getServerPort
public int getServerPort()Gets the server port.- Returns:
- the server port
-
getPort
public int getPort(int defaultPort) Gets the port.- Parameters:
defaultPort
- the default port- Returns:
- the port
-
getSocket
Gets the socket.- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
factory
- the factory- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
localPort
- the local port- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
factory
- the factorylocalPort
- the local port- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
host
- the hostport
- the port- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
factory
- the factoryhost
- the hostport
- the port- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
host
- the hostport
- the portlocalPort
- the local port- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
public Socket getSocket(SocketFactory factory, String host, int port, int localPort) throws IOException Gets the socket.- Parameters:
factory
- the factoryhost
- the hostport
- the portlocalPort
- the local port- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocket
Gets the socket.- Parameters:
serverSocket
- the server socket- Returns:
- the socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
configureConnectedSocket
Configure a connected socket. Used internally by the ClientSocketFactory and SSLClientSocketFactory.- Parameters:
socket
- the socket- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getServerSocket
Gets the server socket.- Returns:
- the server socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getServerSocket
Gets the server socket.- Parameters:
port
- the port- Returns:
- the server socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getServerSocket
Gets the server socket.- Parameters:
factory
- the factoryport
- the port- Returns:
- the server socket
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
isCurrentRMIServerThreadSocketAlive
public static final boolean isCurrentRMIServerThreadSocketAlive()Checks if is current rmi server thread socket alive.- Returns:
- true, if is current rmi server thread socket alive
-
getPublicAddress
-
getLocalAddress
-
configToString
-
configToString
Config to string.- Parameters:
socket
- the socket- Returns:
- the string
- Throws:
SocketException
- the socket exception
-
configToString
Config to string.- Parameters:
socket
- the socket- Returns:
- the string
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getSocketFactory
-
getSSLSocketFactory
public SSLClientSocketFactory getSSLSocketFactory(String protocol, boolean sslValidation) throws KeyManagementException, NoSuchAlgorithmException Gets the SSL socket factory.- Parameters:
protocol
- the protocolsslValidation
- the ssl validation- Returns:
- the SSL socket factory
- Throws:
KeyManagementException
- the key management exceptionNoSuchAlgorithmException
- the no such algorithm exception
-
getBlindlyTrustingSSLContext
public static SSLContext getBlindlyTrustingSSLContext(String protocol) throws NoSuchAlgorithmException, KeyManagementException Gets the blindly trusting SSL context.- Parameters:
protocol
- the protocol- Returns:
- the blindly trusting SSL context
- Throws:
NoSuchAlgorithmException
- the no such algorithm exceptionKeyManagementException
- the key management exception
-