Class ConnectionPoolImpl
- java.lang.Object
-
- io.pravega.client.connection.impl.ConnectionPoolImpl
-
- All Implemented Interfaces:
ConnectionPool,java.lang.AutoCloseable
public class ConnectionPoolImpl extends java.lang.Object implements ConnectionPool
-
-
Constructor Summary
Constructors Constructor Description ConnectionPoolImpl(ClientConfig clientConfig, ConnectionFactory connectionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.util.List<io.pravega.client.connection.impl.ConnectionPoolImpl.Connection>getActiveChannels()java.util.concurrent.CompletableFuture<ClientConnection>getClientConnection(Flow flow, io.pravega.shared.protocol.netty.PravegaNodeUri location, io.pravega.shared.protocol.netty.ReplyProcessor rp)This is used to create aClientConnectionon an existing Connection pool.java.util.concurrent.CompletableFuture<ClientConnection>getClientConnection(io.pravega.shared.protocol.netty.PravegaNodeUri location, io.pravega.shared.protocol.netty.ReplyProcessor rp)This is used to create aClientConnectionwhere flows are disabled.java.util.concurrent.ScheduledExecutorServicegetInternalExecutor()Returns the client internal thread pool executor.voidpruneUnusedConnections()Used only for testing.
-
-
-
Constructor Detail
-
ConnectionPoolImpl
public ConnectionPoolImpl(ClientConfig clientConfig, ConnectionFactory connectionFactory)
-
-
Method Detail
-
getClientConnection
public java.util.concurrent.CompletableFuture<ClientConnection> getClientConnection(Flow flow, io.pravega.shared.protocol.netty.PravegaNodeUri location, io.pravega.shared.protocol.netty.ReplyProcessor rp)
Description copied from interface:ConnectionPoolThis is used to create aClientConnectionon an existing Connection pool. The Connection pool implementation decides if a new connection needs to be established to the PravegaNode or an existing connection can be reused to establish the connection.- Specified by:
getClientConnectionin interfaceConnectionPool- Parameters:
flow- Flowlocation- The Pravega Node Uri.rp- ReplyProcessor instance.- Returns:
- An instance of client connection.
-
getClientConnection
public java.util.concurrent.CompletableFuture<ClientConnection> getClientConnection(io.pravega.shared.protocol.netty.PravegaNodeUri location, io.pravega.shared.protocol.netty.ReplyProcessor rp)
Description copied from interface:ConnectionPoolThis is used to create aClientConnectionwhere flows are disabled. This implies that only one ClientConnection can exist on the underlying connection.- Specified by:
getClientConnectionin interfaceConnectionPool- Parameters:
location- The Pravega Node Uri.rp- ReplyProcessor instance.- Returns:
- An instance of client connection.
-
pruneUnusedConnections
public void pruneUnusedConnections()
Used only for testing.
-
getActiveChannels
public java.util.List<io.pravega.client.connection.impl.ConnectionPoolImpl.Connection> getActiveChannels()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceConnectionPool
-
getInternalExecutor
public java.util.concurrent.ScheduledExecutorService getInternalExecutor()
Description copied from interface:ConnectionPoolReturns the client internal thread pool executor.- Specified by:
getInternalExecutorin interfaceConnectionPool
-
-