public class DbAdmin extends Object
Modifier and Type | Field and Description |
---|---|
protected static io.netty.util.Timer |
dbSessionTimer |
static int |
RETRYNB |
protected DbType |
typeDriver
Database type
|
static long |
WAITFORNETOP |
Constructor and Description |
---|
DbAdmin()
Empty constructor for no Database support (very thin client)
|
DbAdmin(DbModel model,
String server,
String user,
String passwd)
Use a default server for basic connection.
|
DbAdmin(DbModel model,
String server,
String user,
String passwd,
boolean write)
Use a default server for basic connection.
|
Modifier and Type | Method and Description |
---|---|
static void |
addConnection(GUID id,
DbSession session)
Add a Connection into the list
|
static void |
checkAllConnections()
Check all database connections and try to reopen them if disActive
|
void |
close()
Close the underlying session.
|
static void |
closeAllConnection()
Close all database connections
|
void |
commit()
Commit on connection (since in autocommit, should not be used)
|
static void |
decHttpSession()
Decrement nb of Http Connection
|
DbModel |
getDbModel() |
static int |
getHttpSession() |
static int |
getNbConnection() |
String |
getPasswd() |
String |
getServer() |
DbSession |
getSession() |
DbType |
getTypeDriver() |
String |
getUser() |
static void |
incHttpSession()
Increment nb of Http Connection
|
boolean |
isCompatibleWithThreadSharedConnexion() |
boolean |
isReadOnly() |
static void |
removeConnection(GUID id)
Remove a Connection from the list
|
void |
setSession(DbSession session) |
String |
toString() |
void |
validConnection()
Validate connection
|
public static final int RETRYNB
public static final long WAITFORNETOP
protected final DbType typeDriver
protected static final io.netty.util.Timer dbSessionTimer
public DbAdmin(DbModel model, String server, String user, String passwd) throws WaarpDatabaseNoConnectionException
A this time, only one driver is possible! If a new driver is needed, then we need to create a new DbSession object. Be aware that DbSession.initialize should be call only once for each driver, whatever the number of DbSession objects that could be created (=> need a hashtable for specific driver when created). Also, don't know if two drivers at the same time (two different DbSession) is allowed by JDBC.
model
- server
- user
- passwd
- WaarpDatabaseNoConnectionException
public DbAdmin(DbModel model, String server, String user, String passwd, boolean write) throws WaarpDatabaseNoConnectionException
A this time, only one driver is possible! If a new driver is needed, then we need to create a new DbSession object. Be aware that DbSession.initialize should be call only once for each driver, whatever the number of DbSession objects that could be created (=> need a hashtable for specific driver when created). Also, don't know if two drivers at the same time (two different DbSession) is allowed by JDBC.
model
- server
- user
- passwd
- write
- WaarpDatabaseSqlException
WaarpDatabaseNoConnectionException
public DbAdmin()
public DbSession getSession()
public void setSession(DbSession session)
session
- the session to setpublic boolean isReadOnly()
public void validConnection() throws WaarpDatabaseNoConnectionException
public void close()
public void commit() throws WaarpDatabaseSqlException, WaarpDatabaseNoConnectionException
public String getServer()
public String getUser()
public String getPasswd()
public DbModel getDbModel()
public DbType getTypeDriver()
public static void incHttpSession()
public static void decHttpSession()
public static int getHttpSession()
public static void addConnection(GUID id, DbSession session)
id
- session
- public static void removeConnection(GUID id)
id
- Id of the connectionpublic static int getNbConnection()
public static void closeAllConnection()
public static void checkAllConnections()
public boolean isCompatibleWithThreadSharedConnexion()
Copyright © 2009–2020 Waarp. All rights reserved.