public class Pool extends Object implements AutoCloseable, PoolMBean
Constructor and Description |
---|
Pool(UrlParser urlParser,
int poolIndex,
ScheduledThreadPoolExecutor poolExecutor)
Create pool from configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close pool and underlying connections.
|
boolean |
equals(Object obj) |
long |
getActiveConnections() |
MariaDbConnection |
getConnection()
Retrieve new connection.
|
MariaDbConnection |
getConnection(String username,
String password)
Get new connection from pool if user and password correspond to pool.
|
long |
getConnectionRequests() |
GlobalStateInfo |
getGlobalInfo() |
long |
getIdleConnections() |
String |
getPoolTag() |
long |
getTotalConnections() |
UrlParser |
getUrlParser() |
int |
hashCode() |
void |
resetStaticGlobal()
JMX method to remove state (will be reinitialized on next connection creation).
|
List<Long> |
testGetConnectionIdleThreadIds()
For testing purpose only.
|
public Pool(UrlParser urlParser, int poolIndex, ScheduledThreadPoolExecutor poolExecutor)
urlParser
- configuration parserpoolIndex
- pool index to permit distinction of thread namepoolExecutor
- pools common executorpublic MariaDbConnection getConnection() throws SQLException
SQLException
- if no connection is created when reaching timeout (connectTimeout option)public MariaDbConnection getConnection(String username, String password) throws SQLException
username
- usernamepassword
- passwordSQLException
- if any error occur during connectionpublic UrlParser getUrlParser()
public void close() throws InterruptedException
close
in interface AutoCloseable
InterruptedException
- if interruptedpublic String getPoolTag()
public GlobalStateInfo getGlobalInfo()
public long getActiveConnections()
getActiveConnections
in interface PoolMBean
public long getTotalConnections()
getTotalConnections
in interface PoolMBean
public long getIdleConnections()
getIdleConnections
in interface PoolMBean
public long getConnectionRequests()
getConnectionRequests
in interface PoolMBean
public List<Long> testGetConnectionIdleThreadIds()
public void resetStaticGlobal()
resetStaticGlobal
in interface PoolMBean
Copyright © 2019 mariadb.org. All rights reserved.