public class ConcurrentConnection extends java.lang.Object implements KeepAvailable
DatabaseConnection.ConnectionFunction
Constructor and Description |
---|
ConcurrentConnection(DatabaseParameters param)
Initialize.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
connect()
Connect to database.
|
java.sql.Connection |
getConnection()
Get current database connection.
|
int |
getConnection(DatabaseConnection.ConnectionFunction consumer)
Get current database connection.
|
DatabaseParameters |
getParam()
Returns database properties settings.
|
boolean |
isLive()
Returns database state whether available.
|
void |
keep()
Trigger keep-alive event.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
interval
connectIf, createStatementExecutor, loadDriveInstance, tryGetConnection
public ConcurrentConnection(DatabaseParameters param)
param
- database connection settings.public DatabaseParameters getParam()
DatabaseConnection
getParam
in interface DatabaseConnection
public java.sql.Connection getConnection()
DatabaseConnection
getConnection
in interface DatabaseConnection
public int getConnection(DatabaseConnection.ConnectionFunction consumer) throws RaSqlException, RaConnectException
DatabaseConnection
getConnection
in interface DatabaseConnection
consumer
- consumerRaSqlException
- RaSqlExceptionRaConnectException
- if can't to connect database.public boolean connect()
connect
in interface DatabaseConnection
public boolean isLive()
DatabaseConnection
isLive
in interface DatabaseConnection
public void keep()
KeepAlive
public void close() throws RaSqlException
close
in interface java.lang.AutoCloseable
RaSqlException