@Private
@Evolving
public class ConnectionPool
extends java.lang.Object
| Modifier | Constructor | Description |
|---|---|---|
protected |
ConnectionPool(org.apache.hadoop.conf.Configuration config,
java.lang.String address,
org.apache.hadoop.security.UserGroupInformation user,
int minPoolSize,
int maxPoolSize,
float minActiveRatio,
java.lang.Class<?> proto,
PoolAlignmentContext alignmentContext) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addConnection(ConnectionContext conn) |
Add a connection to the current pool.
|
protected void |
close() |
Close the connection pool.
|
java.util.concurrent.atomic.AtomicInteger |
getClientIndex() |
Get the clientIndex used to calculate index for lookup.
|
protected ConnectionContext |
getConnection() |
Return the next connection round-robin.
|
protected ConnectionPoolId |
getConnectionPoolId() |
Get the connection pool identifier.
|
java.lang.String |
getJSON() |
JSON representation of the connection pool.
|
protected long |
getLastActiveTime() |
Get the last time the connection pool was used.
|
protected int |
getMaxSize() |
Get the maximum number of connections allowed in this pool.
|
protected float |
getMinActiveRatio() |
Get the minimum ratio of active connections in this pool.
|
protected int |
getMinSize() |
Get the minimum number of connections in this pool.
|
protected int |
getNumActiveConnections() |
Number of active connections in the pool.
|
protected int |
getNumActiveConnectionsRecently() |
Number of active connections recently in the pool.
|
protected int |
getNumConnections() |
Number of connections in the pool.
|
protected int |
getNumIdleConnections() |
Number of usable i.e.
|
PoolAlignmentContext |
getPoolAlignmentContext() |
Get the alignment context for this pool.
|
ConnectionContext |
newConnection() |
Create a new proxy wrapper for a client NN connection.
|
protected static <T> ConnectionContext |
newConnection(org.apache.hadoop.conf.Configuration conf,
java.lang.String nnAddress,
org.apache.hadoop.security.UserGroupInformation ugi,
java.lang.Class<T> proto,
boolean enableMultiSocket,
int socketIndex,
org.apache.hadoop.ipc.AlignmentContext alignmentContext) |
Creates a proxy wrapper for a client NN connection.
|
java.util.List<ConnectionContext> |
removeConnections(int num) |
Remove connections from the current pool.
|
java.lang.String |
toString() |
protected ConnectionPool(org.apache.hadoop.conf.Configuration config,
java.lang.String address,
org.apache.hadoop.security.UserGroupInformation user,
int minPoolSize,
int maxPoolSize,
float minActiveRatio,
java.lang.Class<?> proto,
PoolAlignmentContext alignmentContext)
throws java.io.IOException
java.io.IOExceptionprotected int getMaxSize()
protected int getMinSize()
protected float getMinActiveRatio()
protected ConnectionPoolId getConnectionPoolId()
@VisibleForTesting public java.util.concurrent.atomic.AtomicInteger getClientIndex()
public PoolAlignmentContext getPoolAlignmentContext()
protected ConnectionContext getConnection()
public void addConnection(ConnectionContext conn)
conn - New connection to add to the pool.public java.util.List<ConnectionContext> removeConnections(int num)
num - Number of connections to remove.protected void close()
protected int getNumConnections()
protected int getNumActiveConnections()
protected int getNumIdleConnections()
protected int getNumActiveConnectionsRecently()
protected long getLastActiveTime()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getJSON()
public ConnectionContext newConnection() throws java.io.IOException
java.io.IOException - If it cannot get a new connection.protected static <T> ConnectionContext newConnection(org.apache.hadoop.conf.Configuration conf, java.lang.String nnAddress, org.apache.hadoop.security.UserGroupInformation ugi, java.lang.Class<T> proto, boolean enableMultiSocket, int socketIndex, org.apache.hadoop.ipc.AlignmentContext alignmentContext) throws java.io.IOException
T - Input type T.conf - Configuration for the connection.nnAddress - Address of server supporting the ClientProtocol.ugi - User context.proto - Interface of the protocol.enableMultiSocket - Enable multiple socket or not.socketIndex - Index for FederationConnectionId.alignmentContext - Client alignment context.java.io.IOException - If it cannot be created.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.