- 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.3 |
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 TypeMethodDescription<T> T
executeSocket
(SocketExecutor<T> executor) Allocates a socket from the default pool and executes the supplied socket executor.<T> T
executeSocket
(SocketExecutor<T> executor, String execName) 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.<T> T
executeSocket
(String poolName, SocketExecutor<T> executor, String execName) Allocates a socket from the specified pool and then executes the supplied socket executor.
-
Method Details
-
executeSocket
Allocates a socket from the default pool and executes the supplied socket executor.This convenience method produces the same result as the following invocation:
executeSocket("default", executor, null);
- Type Parameters:
T
- the type of the value returned by theexecutor
.- Parameters:
executor
- the socket executor to be executed.- Returns:
- the value returned by the
executor
. - Throws:
NullPointerException
- ifexecutor
isnull
.IOException
- if an I/O error occurs.Exception
- if another error occurs.
-
executeSocket
Allocates a socket from the default pool and executes the supplied socket executor.This convenience method produces the same result as the following invocation:
executeSocket("default", executor, tag);
- Type Parameters:
T
- the type of the value returned by theexecutor
.- Parameters:
executor
- the socket executor to be executed.execName
- name of theexecutor
(can be null).- Returns:
- the value returned by the
executor
. - Throws:
NullPointerException
- ifexecutor
isnull
.IOException
- if an I/O error occurs.Exception
- if another error occurs.
-
executeSocket
Allocates a socket from the specified pool and then executes the supplied socket executor.This convenience method produces the same result as the following invocation:
executeSocket(poolName, executor, null);
- Type Parameters:
T
- the type of the value returned by theexecutor
.- 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 isnull
.IOException
- if an I/O error occurs.Exception
- if another error occurs.
-
executeSocket
<T> T executeSocket(String poolName, SocketExecutor<T> executor, String execName) throws IOException, Exception Allocates a socket from the specified pool and then executes the supplied socket executor. If the socket executor throws anIOException
, 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 theexecutor
.- Parameters:
poolName
- the name of the socket pool.executor
- the socket executor to be executed.execName
- name of theexecutor
(can be null).- Returns:
- the value returned by the
executor
. - Throws:
NullPointerException
- if an argument isnull
.IOException
- if an I/O error occurs.Exception
- if another error occurs.
-