public class ConnectionManager extends Object
| Modifier and Type | Method and Description |
|---|---|
int |
checkClusterStates()
Check datanode states of each cluster.
|
List<Integer> |
checkConnectionsValidity()
Check whether the connections are valid in each cluster, and remove invalid connections.
|
static boolean |
checkEnableLeastConn(Properties properties)
check whether the properties enable leastconn.
|
static boolean |
checkEnableQuickAutoBalance(Properties properties)
Check a properties if enable quickAutoBalance.
|
void |
clear()
Clear connection manager.
|
List<Integer> |
closeConnections()
Choose abandoned connections from abandonedConnections of each cluster.
|
int |
decrementCachedCreatingConnectionSize(HostSpec hostSpec,
Properties properties)
Decrement cachedCreatingConnectionSize.
|
int |
getCachedConnectionSize()
Get cached connection size.
|
Cluster |
getCluster(String URLIdentifier) |
static ConnectionManager |
getInstance()
Get instance.
|
static String |
getURLIdentifierFromUrl(String url)
Get URLIdentifier from url, which is a unique id of cluster.
|
int |
incrementCachedCreatingConnectionSize(HostSpec hostSpec,
Properties properties)
Increment cachedCreatingConnectionSize.
|
boolean |
setCluster(Properties properties)
Set cluster into connection manager.
|
boolean |
setConnection(PgConnection pgConnection,
Properties properties)
Cache this connection, if it's configured with autoBalance = "leastconn".
|
void |
setConnectionState(PgConnection pgConnection,
StatementCancelState state)
Set connection state of cached connections if it exists.
|
public List<Integer> closeConnections()
public static boolean checkEnableLeastConn(Properties properties)
properties - propertiespublic static boolean checkEnableQuickAutoBalance(Properties properties)
properties - propertiespublic static ConnectionManager getInstance()
public boolean setCluster(Properties properties) throws PSQLException
properties - propertiesPSQLExceptionpublic boolean setConnection(PgConnection pgConnection, Properties properties) throws PSQLException
pgConnection - connectionproperties - propertiesPSQLExceptionpublic void setConnectionState(PgConnection pgConnection, StatementCancelState state) throws PSQLException
pgConnection - pgConnectionstate - statePSQLExceptionpublic static String getURLIdentifierFromUrl(String url) throws PSQLException
url - urlPSQLExceptionpublic List<Integer> checkConnectionsValidity()
public int checkClusterStates()
public int incrementCachedCreatingConnectionSize(HostSpec hostSpec, Properties properties)
hostSpec - hostSpecproperties - propertiespublic int decrementCachedCreatingConnectionSize(HostSpec hostSpec, Properties properties)
hostSpec - hostSpecproperties - propertiespublic void clear()
public int getCachedConnectionSize()
Copyright © 2023 openGauss. All rights reserved.