Class SocketConfig

java.lang.Object
ecmwf.common.rmi.SocketConfig
Direct Known Subclasses:
RMIClientSocketFactory, RMIServerSocketFactory, RMISSLServerSocketFactory, RMISSLSocketFactory

public class SocketConfig extends Object
The Class SocketConfig.
  • Field Details Link icon

    • MIN_PORT Link icon

      public static final int MIN_PORT
      The Constant MIN_PORT.
    • MAX_PORT Link icon

      public static final int MAX_PORT
      The Constant MAX_PORT.
  • Constructor Details Link icon

    • SocketConfig Link icon

      protected SocketConfig()
      Instantiates a new socket configuration.
    • SocketConfig Link icon

      public SocketConfig(String name)
      Instantiates a new socket config.
      Parameters:
      name - the name
    • SocketConfig Link icon

      public SocketConfig(ClientSocketStatistics statistics, String name)
      Instantiates a new socket config.
      Parameters:
      statistics - the statistics
      name - the name
    • SocketConfig Link icon

      public SocketConfig(ClientSocketStatistics statistics, String name, boolean debug)
      Instantiates a new socket config.
      Parameters:
      statistics - the statistics
      name - the name
      debug - the debug
  • Method Details Link icon

    • load Link icon

      protected void load(String name)
      Load.
      Parameters:
      name - the name
    • getStatistics Link icon

      protected ClientSocketStatistics getStatistics()
      Gets the statistics.
      Returns:
      the statistics
    • withClientSocketFactory Link icon

      protected SocketConfig withClientSocketFactory(ClientSocketFactory clientSocketFactory)
      With client socket factory.
      Parameters:
      clientSocketFactory - the client socket factory
      Returns:
      the socket config
    • setName Link icon

      public void setName(String name)
      Sets the name.
      Parameters:
      name - the new name
    • setDebug Link icon

      public void setDebug(boolean debug)
      Sets the debug.
      Parameters:
      debug - the new debug
    • setTrace Link icon

      public void setTrace(boolean trace)
      Sets the trace.
      Parameters:
      trace - the new trace
    • setListenAddress Link icon

      public void setListenAddress(String listenAddress)
      Sets the listen address.
      Parameters:
      listenAddress - the new listen address
    • setPublicAddress Link icon

      public void setPublicAddress(String publicAddress)
      Sets the public address.
      Parameters:
      publicAddress - the new public address
    • setReceiveBufferSize Link icon

      public void setReceiveBufferSize(int receiveBufferSize)
      Sets the receive buffer size.
      Parameters:
      receiveBufferSize - the new receive buffer size
    • setSendBufferSize Link icon

      public void setSendBufferSize(int sendBufferSize)
      Sets the sends the buffer size.
      Parameters:
      sendBufferSize - the new sends the buffer size
    • setSoTimeOut Link icon

      public void setSoTimeOut(int timeOut)
      Sets the so time out.
      Parameters:
      timeOut - the new so time out
    • setConnectTimeOut Link icon

      public void setConnectTimeOut(int timeOut)
      Sets the connect time out.
      Parameters:
      timeOut - the new connect time out
    • setBackLog Link icon

      public void setBackLog(int backLog)
      Sets the back log.
      Parameters:
      backLog - the new back log
    • setKeepAlive Link icon

      public void setKeepAlive(Boolean keepAlive)
      Sets the keep alive.
      Parameters:
      keepAlive - the new keep alive
    • setTcpNoDelay Link icon

      public void setTcpNoDelay(Boolean tcpNoDelay)
      Sets the tcp no delay.
      Parameters:
      tcpNoDelay - the new tcp no delay
    • setReuseAddress Link icon

      public void setReuseAddress(Boolean reuseAddress)
      Sets the reuse address.
      Parameters:
      reuseAddress - the new reuse address
    • setInterruptible Link icon

      public void setInterruptible(boolean interruptible)
      Sets the interruptible.
      Parameters:
      interruptible - the new interruptible
    • setPrivilegedLocalPort Link icon

      public void setPrivilegedLocalPort(boolean privilegedLocalPort)
      Sets the privileged local port.
      Parameters:
      privilegedLocalPort - the new privileged local port
    • setTCPCongestion Link icon

      public void setTCPCongestion(String tcpCongestion)
      Set a TCP option.
      Parameters:
      tcpCongestion - the TCP congestion algorithm name
    • setSOMaxPacingRate Link icon

      public void setSOMaxPacingRate(Integer soMaxPacingRate)
      Set a SO option.
      Parameters:
      soMaxPacingRate - set the maximum transmit rate in bytes per second for the socket.
    • setSOMaxPacingRate Link icon

      public void setSOMaxPacingRate(ByteSize soMaxPacingRate)
      Set a SO option.
      Parameters:
      soMaxPacingRate - set the maximum transmit rate in bytes per second for the socket.
    • setTCPMaxSegment Link icon

      public void setTCPMaxSegment(Integer tcpMaxSegment)
      Set a TCP option.
      Parameters:
      tcpMaxSegment - maximum amount of data that can be sent in a single TCP segment.
    • setTCPTimeStamp Link icon

      public void setTCPTimeStamp(Boolean tcpTimeStamp)
      Set a TCP option.
      Parameters:
      tcpTimeStamp - enables or disables the use of timestamps in TCP packets
    • setTCPWindowClamp Link icon

      public void setTCPWindowClamp(Integer tcpWindowClamp)
      Set a TCP option.
      Parameters:
      tcpWindowClamp - bound the size of the advertised window to this value
    • setTCPKeepAliveTime Link icon

      public void setTCPKeepAliveTime(Integer tcpKeepAliveTime)
      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 Link icon

      public void setTCPKeepAliveInterval(Integer tcpKeepAliveInterval)
      Set a TCP option.
      Parameters:
      tcpKeepAliveInterval - the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
    • setTCPKeepAliveProbes Link icon

      public void setTCPKeepAliveProbes(Integer tcpKeepAliveProbes)
      Set a TCP option.
      Parameters:
      tcpKeepAliveProbes - the number of unacknowledged probes to send before considering the connection dead and notifying the application layer
    • setTCPLinger Link icon

      public void setTCPLinger(Boolean tcpLingerEnable, Integer tcpLingerTime)
      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 enable
      tcpLingerTime - the amount of time, in seconds, the socket should linger before closing
    • setTCPUserTimeout Link icon

      public void setTCPUserTimeout(Integer tcpUserTimeout)
      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 Link icon

      public void setTCPQuickAck(Boolean tcpQuickAck)
      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 Link icon

      public void setTCPOptions(Socket socket) throws IOException
      Sets the required socket or serverSocket options.
      Parameters:
      socket - the new TCP options
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • setHost Link icon

      public void setHost(String host)
      Sets the host.
      Parameters:
      host - the new host
    • setPort Link icon

      public void setPort(int port)
      Sets the port.
      Parameters:
      port - the new port
    • setServerPort Link icon

      public void setServerPort(int serverPort)
      Sets the server port.
      Parameters:
      serverPort - the new server port
    • getName Link icon

      public String getName()
      Gets the name.
      Returns:
      the name
    • getTrace Link icon

      public boolean getTrace()
      Gets the trace.
      Returns:
      the trace
    • getListenAddress Link icon

      public String getListenAddress()
      Gets the listen address.
      Returns:
      the listen address
    • getPublicAddress Link icon

      public String getPublicAddress()
      Gets the public address.
      Returns:
      the public address
    • getReceiveBufferSize Link icon

      public int getReceiveBufferSize()
      Gets the receive buffer size.
      Returns:
      the receive buffer size
    • getSendBufferSize Link icon

      public int getSendBufferSize()
      Gets the sends the buffer size.
      Returns:
      the sends the buffer size
    • getSOTimeOut Link icon

      public int getSOTimeOut()
      Gets the SO time out.
      Returns:
      the SO time out
    • getConnectTimeOut Link icon

      public int getConnectTimeOut()
      Gets the connect time out.
      Returns:
      the connect time out
    • getBackLog Link icon

      public int getBackLog()
      Gets the back log.
      Returns:
      the back log
    • getKeepAlive Link icon

      public Boolean getKeepAlive()
      Gets the keep alive.
      Returns:
      the keep alive
    • getTcpNoDelay Link icon

      public Boolean getTcpNoDelay()
      Gets the tcp no delay.
      Returns:
      the tcp no delay
    • getReuseAddress Link icon

      public Boolean getReuseAddress()
      Gets the reuse address.
      Returns:
      the reuse address
    • getInterruptible Link icon

      public Boolean getInterruptible()
      Gets the interruptible.
      Returns:
      the interruptible
    • getPrivilegedLocalPort Link icon

      public boolean getPrivilegedLocalPort()
      Gets the privileged local port.
      Returns:
      the privileged local port
    • getHost Link icon

      public String getHost()
      Gets the host.
      Returns:
      the host
    • getHost Link icon

      public String getHost(String defaultHost)
      Gets the host.
      Parameters:
      defaultHost - the default host
      Returns:
      the host
    • getPort Link icon

      public int getPort()
      Gets the port.
      Returns:
      the port
    • getServerPort Link icon

      public int getServerPort()
      Gets the server port.
      Returns:
      the server port
    • getPort Link icon

      public int getPort(int defaultPort)
      Gets the port.
      Parameters:
      defaultPort - the default port
      Returns:
      the port
    • getSocket Link icon

      public Socket getSocket() throws IOException
      Gets the socket.
      Returns:
      the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getSocket Link icon

      public Socket getSocket(SocketFactory factory) throws IOException
      Gets the socket.
      Parameters:
      factory - the factory
      Returns:
      the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getSocket Link icon

      public Socket getSocket(int localPort) throws IOException
      Gets the socket.
      Parameters:
      localPort - the local port
      Returns:
      the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getSocket Link icon

      public Socket getSocket(SocketFactory factory, int localPort) throws IOException
      Gets the socket.
      Parameters:
      factory - the factory
      localPort - the local port
      Returns:
      the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getSocket Link icon

      public Socket getSocket(String host, int port) throws IOException
      Gets the socket.
      Parameters:
      host - the host
      port - the port
      Returns:
      the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getSocket Link icon

      public Socket getSocket(SocketFactory factory, String host, int port) throws IOException
      Gets 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.
    • getSocket Link icon

      public Socket getSocket(String host, int port, int localPort) throws IOException
      Gets 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.
    • getSocket Link icon

      public 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.
    • getSocket Link icon

      public Socket getSocket(ServerSocket serverSocket) throws IOException
      Gets the socket.
      Parameters:
      serverSocket - the server socket
      Returns:
      the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • configureConnectedSocket Link icon

      protected void configureConnectedSocket(Socket socket) throws IOException
      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 Link icon

      public ServerSocket getServerSocket() throws IOException
      Gets the server socket.
      Returns:
      the server socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getServerSocket Link icon

      public ServerSocket getServerSocket(int port) throws IOException
      Gets the server socket.
      Parameters:
      port - the port
      Returns:
      the server socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getServerSocket Link icon

      public ServerSocket getServerSocket(ServerSocketFactory factory, int port) throws IOException
      Gets the server socket.
      Parameters:
      factory - the factory
      port - the port
      Returns:
      the server socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • isCurrentRMIServerThreadSocketAlive Link icon

      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 Link icon

      public static final String getPublicAddress(String name)
      Gets the public address.
      Parameters:
      name - the name
      Returns:
      the public address
    • getLocalAddress Link icon

      public static final String getLocalAddress()
      Gets the local address.
      Returns:
      the local address
    • configToString Link icon

      public String configToString()
      Config to string.
      Returns:
      the string
    • configToString Link icon

      public String configToString(Socket socket) throws SocketException
      Config to string.
      Parameters:
      socket - the socket
      Returns:
      the string
      Throws:
      SocketException - the socket exception
    • configToString Link icon

      public String configToString(ServerSocket socket) throws IOException
      Config to string.
      Parameters:
      socket - the socket
      Returns:
      the string
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getSocketFactory Link icon

      public ClientSocketFactory getSocketFactory()
      Gets the socket factory.
      Returns:
      the socket factory
    • getSSLSocketFactory Link icon

      public 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
    • getBlindlyTrustingSSLContext Link icon

      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 exception
      KeyManagementException - the key management exception