Interface SocketServices

All Known Implementing Classes:
ServerChannel

public interface SocketServices
Services for executing network I/O with managed sockets.
 
Property Description Type Default
socket.«name».connect.timeout Maximum time to wait for a connection (milliseconds) Integer 0 (forever)
socket.«name».host Name or IP address of remote host String required
socket.«name».keep.alive Enable or disable the socket SO_KEEPALIVE option Boolean true
socket.«name».key.store.file Path of the JKS key store file used for SSL authentication String none
socket.«name».key.store.password Password of the JKS key store file used for SSL authentication String none
socket.«name».max.idle Maximum number of idle sockets Integer 8
socket.«name».max.total Maximum number of total sockets Integer 8
socket.«name».max.wait.time Maximum time to wait for a free socket (milliseconds) Integer 0 (forever)
socket.«name».port Port number of remote host Integer required
socket.«name».read.timeout Maximum time to wait for a socket read (milliseconds) Integer 0 (forever)
socket.«name».ssl.protocol Name of the protocol used to create SSL connections String TLSv1.2
socket.«name».tcp.nodelay Enable or disable the socket TCP_NODELAY option Boolean true
socket.«name».trust.store.file Path of the JKS trust store file used for SSL connections String none
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    Allocates a socket from the default pool and executes the supplied socket executor.
    <T> T
    executeSocket(String poolName, SocketExecutor<T> executor)
    Allocates a socket from the specified pool and then executes the supplied socket executor.
  • Method Details

    • executeSocket

      <T> T executeSocket(SocketExecutor<T> executor) throws IOException, Exception
      Allocates a socket from the default pool and executes the supplied socket executor. If the socket executor throws an IOException, the socket is closed and not returned to the pool. If the socket executor terminates successfully, or if it throws any other exception, the socket is returned to the pool.

      This convenience method produces the same result as the following invocation:

      executeSocket("default", executor);
      Type Parameters:
      T - the type of the value returned by the executor.
      Parameters:
      executor - the socket executor to be executed.
      Returns:
      the value returned by the executor.
      Throws:
      NullPointerException - if executor is null.
      IOException - if an I/O error occurs.
      Exception - if another error occurs.
    • executeSocket

      <T> T executeSocket(String poolName, SocketExecutor<T> executor) throws IOException, Exception
      Allocates a socket from the specified pool and then executes the supplied socket executor. If the socket executor throws an IOException, the socket is closed and not returned to the pool. If the socket executor terminates successfully, or if it throws any other exception, the socket is returned to the pool.
      Type Parameters:
      T - the type of the value returned by the executor.
      Parameters:
      poolName - the name of the socket pool.
      executor - the socket executor to be executed.
      Returns:
      the value returned by the executor.
      Throws:
      NullPointerException - if an argument is null.
      IOException - if an I/O error occurs.
      Exception - if another error occurs.