public class DatabaseConnections
extends java.lang.Object
Constructor and Description |
---|
DatabaseConnections()
Create database connection.
|
DatabaseConnections(java.lang.String name)
Create database connection.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close all database connection.
|
void |
connect(DatabaseParameters param,
int count,
java.util.concurrent.Callable<DatabaseConnection> connectionMode)
Create Kept connections.
|
void |
connectConcurrentConnection(DatabaseParameters param,
int count)
Create the Connect Object are kept connected.
|
void |
connectOriginalConnection(DatabaseParameters param,
int count)
There is non lock when executes SQL, probable return error results when execute insert.
|
DatabaseConnection |
getConnection(int index)
Returns database connection.
|
java.lang.String |
getName()
Returns connection alias of database.
|
StatementExecutor |
getStatementExecutor(int index)
Returns SQL statement executer.
|
StatementExecutor |
next()
Take StatementExecutor by round-robin, It's practical when had multi connections.
|
public DatabaseConnections()
public DatabaseConnections(java.lang.String name)
name
- Connection alias.public java.lang.String getName()
public void connectConcurrentConnection(DatabaseParameters param, int count)
param
- The parameters of database connect setting.count
- Kept connections count by the same database.public void connectOriginalConnection(DatabaseParameters param, int count)
param
- The parameters of database connect setting.count
- Kept connections count by the same database.public void connect(DatabaseParameters param, int count, java.util.concurrent.Callable<DatabaseConnection> connectionMode) throws java.lang.Exception
param
- The parameters of database connect setting.count
- Kept connections count by the same database.connectionMode
- Need to be used database connect Object.java.lang.Exception
- Throwable any exception, Throw the ConnectException when connect fail.public StatementExecutor next()
StatementExecutor
public StatementExecutor getStatementExecutor(int index)
index
- indexpublic DatabaseConnection getConnection(int index)
index
- indexpublic void close()