Class ConnectionClientPool
- java.lang.Object
-
- org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool
-
public class ConnectionClientPool extends Object
Registry of client connections.
-
-
Constructor Summary
Constructors Constructor Description ConnectionClientPool(TcpCommunicationConfiguration cfg, AttributeNames attrs, IgniteLogger log, TcpCommunicationMetricsListener metricsLsnr, Supplier<ClusterNode> locNodeSupplier, Function<UUID,ClusterNode> nodeGetter, Supplier<MessageFormatter> msgFormatterSupplier, WorkersRegistry registry, TcpCommunicationSpi tcpCommSpi, ClusterStateProvider clusterStateProvider, GridNioServerWrapper nioSrvWrapper, String igniteInstanceName)
-
Method Summary
-
-
-
Constructor Detail
-
ConnectionClientPool
public ConnectionClientPool(TcpCommunicationConfiguration cfg, AttributeNames attrs, IgniteLogger log, TcpCommunicationMetricsListener metricsLsnr, Supplier<ClusterNode> locNodeSupplier, Function<UUID,ClusterNode> nodeGetter, Supplier<MessageFormatter> msgFormatterSupplier, WorkersRegistry registry, TcpCommunicationSpi tcpCommSpi, ClusterStateProvider clusterStateProvider, GridNioServerWrapper nioSrvWrapper, String igniteInstanceName)
- Parameters:
cfg- Config.attrs- Attributes.log- Logger.metricsLsnr- Metrics listener.locNodeSupplier- Local node supplier.nodeGetter- Node getter.msgFormatterSupplier- Message formatter supplier.registry- Registry.tcpCommSpi- Tcp communication spi.clusterStateProvider- Cluster state provider.nioSrvWrapper- Nio server wrapper.igniteInstanceName- Ignite instance name.
-
-
Method Detail
-
stop
public void stop()
-
reserveClient
public GridCommunicationClient reserveClient(ClusterNode node, int connIdx) throws IgniteCheckedException
Returns existing or just created client to node.- Parameters:
node- Node to which client should be open.connIdx- Connection index.- Returns:
- The existing or just created client.
- Throws:
IgniteCheckedException- Thrown if any exception occurs.
-
createCommunicationClient
@Nullable public @Nullable GridCommunicationClient createCommunicationClient(ClusterNode node, int connIdx) throws IgniteCheckedException
- Parameters:
node- Node to create client for.connIdx- Connection index.- Returns:
- Client.
- Throws:
IgniteCheckedException- If failed.
-
clientString
public String clientString(GridCommunicationClient client, ClusterNode node) throws IgniteCheckedException
Returns the string representation of client with protection from null client value. If the client if null, string representation is built from cluster node.- Parameters:
client- communication clientnode- cluster node to which the client tried to establish a connection- Returns:
- string representation of client
- Throws:
IgniteCheckedException- if failed
-
addNodeClient
public void addNodeClient(ClusterNode node, int connIdx, GridCommunicationClient addClient)
- Parameters:
node- Node.connIdx- Connection index.addClient- Client to add.
-
removeNodeClient
public boolean removeNodeClient(UUID nodeId, GridCommunicationClient rmvClient)
- Parameters:
nodeId- Node ID.rmvClient- Client to remove.- Returns:
Trueif client was removed.
-
forceCloseConnection
public void forceCloseConnection(UUID nodeId) throws IgniteCheckedException
Closing connections to node. NOTE: It is recommended only for tests.- Parameters:
nodeId- Node for which to close connections.- Throws:
IgniteCheckedException- If occurs.
-
onNodeLeft
public void onNodeLeft(UUID nodeId)
- Parameters:
nodeId- Node id.
-
clientFor
public GridCommunicationClient[] clientFor(UUID id)
- Parameters:
id- Id.
-
entrySet
public Iterable<? extends Map.Entry<UUID,GridCommunicationClient[]>> entrySet()
Clients entries.
-
removeFut
public void removeFut(ConnectionKey connKey, GridFutureAdapter<GridCommunicationClient> fut)
- Parameters:
connKey- Connection key.fut- Future.
-
getFut
public GridFutureAdapter<GridCommunicationClient> getFut(ConnectionKey connKey)
- Parameters:
connKey- Connection key.
-
putIfAbsentFut
public GridFutureAdapter<GridCommunicationClient> putIfAbsentFut(ConnectionKey key, GridFutureAdapter<GridCommunicationClient> fut)
- Parameters:
key- Key.fut- Future.
-
forceClose
public void forceClose()
Close all connections of this instance.
-
completeFutures
public void completeFutures(IgniteClientDisconnectedCheckedException err)
- Parameters:
err- Err.
-
metricsListener
public void metricsListener(@Nullable @Nullable TcpCommunicationMetricsListener metricsLsnr)- Parameters:
metricsLsnr- New statistics.
-
-