public class NebulaPool extends Object
| Constructor and Description |
|---|
NebulaPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close the pool, all connections will be closed
|
int |
getActiveConnNum()
Get the number of connections was used by users
|
protected SyncConnection |
getConnection() |
int |
getIdleConnNum()
Get the number of free connections in the pool
|
Session |
getSession(String userName,
String password,
boolean reconnect)
get a session from the NebulaPool
|
int |
getWaitersNum()
Get the number of waits in a waiting get connection
|
boolean |
init(List<HostAddress> addresses,
NebulaPoolConfig config) |
protected void |
returnConnection(SyncConnection connection)
Return the connection to object pool
|
protected void |
setInvalidateConnection(SyncConnection connection)
Set the connection is invalidate, and the object pool will destroy it
|
protected void |
updateServerStatus()
Update the services' status when the connection is broken,
it is called by Session and NebulaPool
|
public boolean init(List<HostAddress> addresses, NebulaPoolConfig config) throws UnknownHostException, InvalidConfigException
addresses - the graphd services addressesconfig - the config for the poolUnknownHostException - if host address is illegalInvalidConfigException - if config is illegalpublic void close()
public Session getSession(String userName, String password, boolean reconnect) throws NotValidConnectionException, IOErrorException, AuthFailedException, ClientServerIncompatibleException
userName - the userName to authenticate with nebula-graphpassword - the password to authenticate with nebula-graphreconnect - whether to retry after the connection is disconnectedNotValidConnectionException - if get connection failedIOErrorException - if get unexpected exceptionAuthFailedException - if authenticate failedClientServerIncompatibleExceptionpublic int getActiveConnNum()
public int getIdleConnNum()
public int getWaitersNum()
protected void updateServerStatus()
protected void setInvalidateConnection(SyncConnection connection)
connection - the invalidate connectionprotected void returnConnection(SyncConnection connection)
connection - the return connectionprotected SyncConnection getConnection() throws NotValidConnectionException
NotValidConnectionExceptionCopyright © 2022. All rights reserved.