Class SocketConfig
java.lang.Object
ecmwf.common.rmi.SocketConfig
- Direct Known Subclasses:
- RMIClientSocketFactory,- RMIServerSocketFactory,- RMISSLServerSocketFactory,- RMISSLSocketFactory
The Class SocketConfig.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedInstantiates 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 SummaryModifier and TypeMethodDescriptionConfig to string.configToString(ServerSocket socket) Config to string.configToString(Socket socket) Config to string.protected voidconfigureConnectedSocket(Socket socket) Configure a connected socket.intGets the back log.static SSLContextgetBlindlyTrustingSSLContext(String protocol) Gets the blindly trusting SSL context.intGets the connect time out.getHost()Gets the host.Gets the host.Gets the interruptible.Gets the keep alive.Gets the listen address.static final StringGets the local address.getName()Gets the name.intgetPort()Gets the port.intgetPort(int defaultPort) Gets the port.booleanGets the privileged local port.Gets the public address.static final StringgetPublicAddress(String name) Gets the public address.intGets the receive buffer size.Gets the reuse address.intGets the sends the buffer size.intGets 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.intGets the SO time out.getSSLSocketFactory(String protocol, boolean sslValidation) Gets the SSL socket factory.protected ClientSocketStatisticsGets the statistics.Gets the tcp no delay.booleangetTrace()Gets the trace.static final booleanChecks if is current rmi server thread socket alive.protected voidLoad.voidsetBackLog(int backLog) Sets the back log.voidsetConnectTimeOut(int timeOut) Sets the connect time out.voidsetDebug(boolean debug) Sets the debug.voidSets the host.voidsetInterruptible(boolean interruptible) Sets the interruptible.voidsetKeepAlive(Boolean keepAlive) Sets the keep alive.voidsetListenAddress(String listenAddress) Sets the listen address.voidSets the name.voidsetPort(int port) Sets the port.voidsetPrivilegedLocalPort(boolean privilegedLocalPort) Sets the privileged local port.voidsetPublicAddress(String publicAddress) Sets the public address.voidsetReceiveBufferSize(int receiveBufferSize) Sets the receive buffer size.voidsetReuseAddress(Boolean reuseAddress) Sets the reuse address.voidsetSendBufferSize(int sendBufferSize) Sets the sends the buffer size.voidsetServerPort(int serverPort) Sets the server port.voidsetSOMaxPacingRate(ByteSize soMaxPacingRate) Set a SO option.voidsetSOMaxPacingRate(Integer soMaxPacingRate) Set a SO option.voidsetSoTimeOut(int timeOut) Sets the so time out.voidsetTCPCongestion(String tcpCongestion) Set a TCP option.voidsetTCPKeepAliveInterval(Integer tcpKeepAliveInterval) Set a TCP option.voidsetTCPKeepAliveProbes(Integer tcpKeepAliveProbes) Set a TCP option.voidsetTCPKeepAliveTime(Integer tcpKeepAliveTime) Set a TCP option.voidsetTCPLinger(Boolean tcpLingerEnable, Integer tcpLingerTime) Controls the behavior of a socket when it is closed and there is unsent data.voidsetTCPMaxSegment(Integer tcpMaxSegment) Set a TCP option.voidsetTcpNoDelay(Boolean tcpNoDelay) Sets the tcp no delay.voidsetTCPOptions(Socket socket) Sets the required socket or serverSocket options.voidsetTCPQuickAck(Boolean tcpQuickAck) Controls whether the TCP stack should quickly acknowledge incoming data.voidsetTCPTimeStamp(Boolean tcpTimeStamp) Set a TCP option.voidsetTCPUserTimeout(Integer tcpUserTimeout) Provides a way to control the timeout for unacknowledged data on a TCP connection.voidsetTCPWindowClamp(Integer tcpWindowClamp) Set a TCP option.voidsetTrace(boolean trace) Sets the trace.protected SocketConfigwithClientSocketFactory(ClientSocketFactory clientSocketFactory) With client socket factory.
- 
Field Details- 
MIN_PORTpublic static final int MIN_PORTThe Constant MIN_PORT.
- 
MAX_PORTpublic static final int MAX_PORTThe Constant MAX_PORT.
 
- 
- 
Constructor Details- 
SocketConfigprotected SocketConfig()Instantiates a new socket configuration.
- 
SocketConfig
- 
SocketConfigInstantiates a new socket config.- Parameters:
- statistics- the statistics
- name- the name
 
- 
SocketConfigInstantiates a new socket config.- Parameters:
- statistics- the statistics
- name- the name
- debug- the debug
 
 
- 
- 
Method Details- 
load
- 
getStatistics
- 
withClientSocketFactoryWith client socket factory.- Parameters:
- clientSocketFactory- the client socket factory
- Returns:
- the socket config
 
- 
setName
- 
setDebugpublic void setDebug(boolean debug) Sets the debug.- Parameters:
- debug- the new debug
 
- 
setTracepublic void setTrace(boolean trace) Sets the trace.- Parameters:
- trace- the new trace
 
- 
setListenAddressSets the listen address.- Parameters:
- listenAddress- the new listen address
 
- 
setPublicAddressSets the public address.- Parameters:
- publicAddress- the new public address
 
- 
setReceiveBufferSizepublic void setReceiveBufferSize(int receiveBufferSize) Sets the receive buffer size.- Parameters:
- receiveBufferSize- the new receive buffer size
 
- 
setSendBufferSizepublic void setSendBufferSize(int sendBufferSize) Sets the sends the buffer size.- Parameters:
- sendBufferSize- the new sends the buffer size
 
- 
setSoTimeOutpublic void setSoTimeOut(int timeOut) Sets the so time out.- Parameters:
- timeOut- the new so time out
 
- 
setConnectTimeOutpublic void setConnectTimeOut(int timeOut) Sets the connect time out.- Parameters:
- timeOut- the new connect time out
 
- 
setBackLogpublic void setBackLog(int backLog) Sets the back log.- Parameters:
- backLog- the new back log
 
- 
setKeepAliveSets the keep alive.- Parameters:
- keepAlive- the new keep alive
 
- 
setTcpNoDelaySets the tcp no delay.- Parameters:
- tcpNoDelay- the new tcp no delay
 
- 
setReuseAddressSets the reuse address.- Parameters:
- reuseAddress- the new reuse address
 
- 
setInterruptiblepublic void setInterruptible(boolean interruptible) Sets the interruptible.- Parameters:
- interruptible- the new interruptible
 
- 
setPrivilegedLocalPortpublic void setPrivilegedLocalPort(boolean privilegedLocalPort) Sets the privileged local port.- Parameters:
- privilegedLocalPort- the new privileged local port
 
- 
setTCPCongestionSet a TCP option.- Parameters:
- tcpCongestion- the TCP congestion algorithm name
 
- 
setSOMaxPacingRateSet a SO option.- Parameters:
- soMaxPacingRate- set the maximum transmit rate in bytes per second for the socket.
 
- 
setSOMaxPacingRateSet a SO option.- Parameters:
- soMaxPacingRate- set the maximum transmit rate in bytes per second for the socket.
 
- 
setTCPMaxSegmentSet a TCP option.- Parameters:
- tcpMaxSegment- maximum amount of data that can be sent in a single TCP segment.
 
- 
setTCPTimeStampSet a TCP option.- Parameters:
- tcpTimeStamp- enables or disables the use of timestamps in TCP packets
 
- 
setTCPWindowClampSet a TCP option.- Parameters:
- tcpWindowClamp- bound the size of the advertised window to this value
 
- 
setTCPKeepAliveTimeSet 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
 
- 
setTCPKeepAliveIntervalSet a TCP option.- Parameters:
- tcpKeepAliveInterval- the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
 
- 
setTCPKeepAliveProbesSet a TCP option.- Parameters:
- tcpKeepAliveProbes- the number of unacknowledged probes to send before considering the connection dead and notifying the application layer
 
- 
setTCPLingerControls 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 enable
- tcpLingerTime- the amount of time, in seconds, the socket should linger before closing
 
- 
setTCPUserTimeoutProvides 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
 
- 
setTCPQuickAckControls 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.
 
- 
setTCPOptionsSets the required socket or serverSocket options.- Parameters:
- socket- the new TCP options
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
setHost
- 
setPortpublic void setPort(int port) Sets the port.- Parameters:
- port- the new port
 
- 
setServerPortpublic void setServerPort(int serverPort) Sets the server port.- Parameters:
- serverPort- the new server port
 
- 
getName
- 
getTracepublic boolean getTrace()Gets the trace.- Returns:
- the trace
 
- 
getListenAddress
- 
getPublicAddress
- 
getReceiveBufferSizepublic int getReceiveBufferSize()Gets the receive buffer size.- Returns:
- the receive buffer size
 
- 
getSendBufferSizepublic int getSendBufferSize()Gets the sends the buffer size.- Returns:
- the sends the buffer size
 
- 
getSOTimeOutpublic int getSOTimeOut()Gets the SO time out.- Returns:
- the SO time out
 
- 
getConnectTimeOutpublic int getConnectTimeOut()Gets the connect time out.- Returns:
- the connect time out
 
- 
getBackLogpublic int getBackLog()Gets the back log.- Returns:
- the back log
 
- 
getKeepAlive
- 
getTcpNoDelay
- 
getReuseAddress
- 
getInterruptible
- 
getPrivilegedLocalPortpublic boolean getPrivilegedLocalPort()Gets the privileged local port.- Returns:
- the privileged local port
 
- 
getHost
- 
getHost
- 
getPortpublic int getPort()Gets the port.- Returns:
- the port
 
- 
getServerPortpublic int getServerPort()Gets the server port.- Returns:
- the server port
 
- 
getPortpublic int getPort(int defaultPort) Gets the port.- Parameters:
- defaultPort- the default port
- Returns:
- the port
 
- 
getSocketGets the socket.- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- factory- the factory
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- localPort- the local port
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- factory- the factory
- localPort- the local port
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- host- the host
- port- the port
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- factory- the factory
- host- the host
- port- the port
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- host- the host
- port- the port
- localPort- the local port
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketpublic Socket getSocket(SocketFactory factory, String host, int port, int localPort) throws IOException Gets the socket.- Parameters:
- factory- the factory
- host- the host
- port- the port
- localPort- the local port
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketGets the socket.- Parameters:
- serverSocket- the server socket
- Returns:
- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
configureConnectedSocketConfigure a connected socket. Used internally by the ClientSocketFactory and SSLClientSocketFactory.- Parameters:
- socket- the socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getServerSocketGets the server socket.- Returns:
- the server socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getServerSocketGets the server socket.- Parameters:
- port- the port
- Returns:
- the server socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getServerSocketGets the server socket.- Parameters:
- factory- the factory
- port- the port
- Returns:
- the server socket
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
isCurrentRMIServerThreadSocketAlivepublic 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
- 
configToStringConfig to string.- Parameters:
- socket- the socket
- Returns:
- the string
- Throws:
- SocketException- the socket exception
 
- 
configToStringConfig to string.- Parameters:
- socket- the socket
- Returns:
- the string
- Throws:
- IOException- Signals that an I/O exception has occurred.
 
- 
getSocketFactory
- 
getSSLSocketFactorypublic SSLClientSocketFactory getSSLSocketFactory(String protocol, boolean sslValidation) throws KeyManagementException, NoSuchAlgorithmException Gets the SSL socket factory.- Parameters:
- protocol- the protocol
- sslValidation- the ssl validation
- Returns:
- the SSL socket factory
- Throws:
- KeyManagementException- the key management exception
- NoSuchAlgorithmException- the no such algorithm exception
 
- 
getBlindlyTrustingSSLContextpublic 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 exception
- KeyManagementException- the key management exception
 
 
-