public interface ConnectionPoolComponent extends Component
Lifecyclable.State
LIFECYCLABLE_LOGGER
Modifier and Type | Method and Description |
---|---|
default Class<ConnectionPoolComponent> |
getComponentClass()
Returns the Component interface Class this Component implements.
|
PoolableConnection |
getConnection(String uri,
String user,
String password)
Returns a {link PoolableConnection} from this connection pool.
|
long |
getMaxAge()
Returns the maximum age for recyclable connections.
|
int |
getMaxRetainSize()
Returns the maximum number of connection this pool will retain when
connections are returned.
|
int |
leaseSize()
Returns the current number of leased connections from the pool.
|
Connection |
newConnection(String uri,
String user,
String password)
Creates and returns a new
Connection for the given parameters. |
int |
poolSize()
Returns the current number of idle connections in the pool.
|
void |
returnConnection(PoolableConnection connection)
Returns a
PoolableConnection to the pool. |
void |
setMaxAge(long maxAge)
Sets the maximum age for recyclable connections.
|
void |
setMaxRetainSize(int size)
Sets the maximum number of connection this pool will retain when
connections are returned.
|
asSoftware, defaultCopy, getSpeedment, isInternal
getState, initialize, isInitialized, isLoaded, isResolved, isStarted, isStopped, load, onInitialize, onLoad, onResolve, onStart, onStop, postStop, preInitialize, preLoad, preResolve, preStart, preStop, resolve, setState, start, stop
default Class<ConnectionPoolComponent> getComponentClass()
Component
getComponentClass
in interface Component
PoolableConnection getConnection(String uri, String user, String password) throws SQLException
uri
- the connection URI for the connectoruser
- the user for the connectorpassword
- the password for the connectorPoolableConnection
from this connection poolSQLException
- if a connection can neither be obtained
from the pool nor created.void returnConnection(PoolableConnection connection)
PoolableConnection
to the pool. If the
PoolableConnection has expired or has a closed underlying connection, it
will be discarded from the pool.connection
- to return to the poolConnection newConnection(String uri, String user, String password) throws SQLException
Connection
for the given parameters.
This method is called whenever the pool needs to allocate a new
Connection.uri
- the connection URI for the connectoruser
- the user for the connectorpassword
- the password for the connectorConnection
for the given parametersSQLException
- if a new connection cannot be createdint poolSize()
int leaseSize()
int getMaxRetainSize()
void setMaxRetainSize(int size)
size
- is the maximum number of connection this pool will retain
when connections are returnedlong getMaxAge()
void setMaxAge(long maxAge)
maxAge
- the maximum age for recyclable connectionsCopyright © 2016 Speedment, Inc.. All rights reserved.