|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ConnectionManager
Connection manager of connection pool
| Method Summary | |
|---|---|
void |
add(Connection connection)
Add a connection to ConnectionPool. |
void |
add(Connection connection,
String poolKey)
Add a connection to ConnectionPool with the specified poolKey. |
void |
check(Connection connection)
check a connection whether available, if not, throw RemotingException |
int |
count(String poolKey)
Get the number of Connection in ConnectionPool with the specified pool key |
Connection |
create(String address,
int connectTimeout)
Create a connection using specified String address. |
Connection |
create(String ip,
int port,
int connectTimeout)
Create a connection using specified ip and port. |
Connection |
create(Url url)
Create a connection using specified Url. |
void |
createConnectionAndHealIfNeed(Url url)
This method can create connection pool with connections initialized and check the number of connections. |
Connection |
get(String poolKey)
Get a connection from ConnectionPool with the specified poolKey. |
Map<String,List<Connection>> |
getAll()
Get all connections of all poolKey. |
List<Connection> |
getAll(String poolKey)
Get all connections from ConnectionPool with the specified poolKey. |
Connection |
getAndCreateIfAbsent(Url url)
Get a connection using Url, if null then create and add into ConnectionPool. |
void |
init()
init |
void |
remove(Connection connection)
Remove a Connection from all ConnectionPool with the poolKeys in Connection, and close it. |
void |
remove(Connection connection,
String poolKey)
Remove and close a Connection from ConnectionPool with the specified poolKey. |
void |
remove(String poolKey)
Remove and close all connections from ConnectionPool with the specified poolKey. |
void |
removeAll()
Remove and close all connections from all ConnectionPool. |
| Methods inherited from interface com.alipay.remoting.Scannable |
|---|
scan |
| Method Detail |
|---|
void init()
void add(Connection connection)
ConnectionPool.
If it contains multiple pool keys, this connection will be added to multiple ConnectionPool too.
connection - an available connection, you should check(Connection) this connection before add
void add(Connection connection,
String poolKey)
ConnectionPool with the specified poolKey.
connection - an available connection, you should check(Connection) this connection before addpoolKey - unique key of a ConnectionPoolConnection get(String poolKey)
ConnectionPool with the specified poolKey.
poolKey - unique key of a ConnectionPool
Connection selected by ConnectionSelectStrategynull if there is no ConnectionPool mapping with poolKeynull if there is no Connection in ConnectionPool.List<Connection> getAll(String poolKey)
ConnectionPool with the specified poolKey.
poolKey - unique key of a ConnectionPool
ConnectionConnectionPool mapping with poolKey.Map<String,List<Connection>> getAll()
void remove(Connection connection)
Connection from all ConnectionPool with the poolKeys in Connection, and close it.
connection -
void remove(Connection connection,
String poolKey)
Connection from ConnectionPool with the specified poolKey.
connection - poolKey - unique key of a ConnectionPoolvoid remove(String poolKey)
ConnectionPool with the specified poolKey.
poolKey - unique key of a ConnectionPoolvoid removeAll()
ConnectionPool.
void check(Connection connection)
throws RemotingException
connection -
RemotingExceptionint count(String poolKey)
Connection in ConnectionPool with the specified pool key
poolKey - unique key of a ConnectionPool
Connection getAndCreateIfAbsent(Url url)
throws InterruptedException,
RemotingException
Url, if null then create and add into ConnectionPool.
The connection number of ConnectionPool is decided by Url.getConnNum()
url - Url contains connect infos.
Connection.
InterruptedException - if interrupted
RemotingException - if create failed.
void createConnectionAndHealIfNeed(Url url)
throws InterruptedException,
RemotingException
ConnectionPool is decided by Url.getConnNum().
Each time call this method, will check the number of connection, if not enough, this will do the healing logic additionally.
url -
InterruptedException
RemotingException
Connection create(Url url)
throws RemotingException
Url.
url - Url contains connect infos.
RemotingException
Connection create(String address,
int connectTimeout)
throws RemotingException
String address.
address - a String address, e.g. 127.0.0.1:1111connectTimeout - an int connect timeout value
Connection
RemotingException - if create failed
Connection create(String ip,
int port,
int connectTimeout)
throws RemotingException
ip - connect ip, e.g. 127.0.0.1port - connect port, e.g. 1111connectTimeout - an int connect timeout value
Connection
RemotingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||