org.hsqldb
Class DatabaseManager
- java.lang.Object
-
- org.hsqldb.DatabaseManager
-
public class DatabaseManager extends java.lang.ObjectHandles initial attempts to connect to HSQLDB databases within the JVM (or a classloader within the JVM). Opens the database if it is not open or connects to it if it is already open. This allows the same database to be used by different instances of Server and by direct connections.Maintains a map of Server instances and notifies each server when its database has shut down.
Maintains a reference to the timer used for file locks and logging.
- Since:
- 1.7.2
-
-
Constructor Summary
Constructors Constructor and Description DatabaseManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidcloseDatabases(int mode)Closes all the databases using the given mode.static voiddeRegisterServer(Server server)Deregisters a server completely.static DatabasegetDatabase(int id)static DatabasegetDatabase(java.lang.String type, java.lang.String path, HsqlProperties props)This has to be improved once a threading model is in place.static intgetDatabase(java.lang.String type, java.lang.String path, Server server, HsqlProperties props)Used by server to open or create a databasestatic java.util.VectorgetDatabaseURIs()Returns a vector containing the URI (type + path) for all the databases.static SessiongetSession(int dbId, long sessionId)Returns an existing session.static HsqlTimergetTimer()static DatabaselookupDatabaseObject(java.lang.String type, java.lang.String path)Looks up database of a given type and path in the registry.static SessionnewSession(int dbID, java.lang.String user, java.lang.String password, java.lang.String zoneString, int timeZoneSeconds)Used by server to open a new sessionstatic SessionnewSession(java.lang.String type, java.lang.String path, java.lang.String user, java.lang.String password, HsqlProperties props, java.lang.String zoneString, int timeZoneSeconds)Used by in-process connections and by Servletstatic voidshutdownDatabases(Server server, int shutdownMode)
-
-
-
Method Detail
-
getDatabaseURIs
public static java.util.Vector getDatabaseURIs()
Returns a vector containing the URI (type + path) for all the databases.
-
closeDatabases
public static void closeDatabases(int mode)
Closes all the databases using the given mode.CLOSEMODE_IMMEDIATELY = 1; CLOSEMODE_NORMAL = 2; CLOSEMODE_COMPACT = 3; CLOSEMODE_SCRIPT = 4;
-
newSession
public static Session newSession(int dbID, java.lang.String user, java.lang.String password, java.lang.String zoneString, int timeZoneSeconds)
Used by server to open a new session
-
newSession
public static Session newSession(java.lang.String type, java.lang.String path, java.lang.String user, java.lang.String password, HsqlProperties props, java.lang.String zoneString, int timeZoneSeconds)
Used by in-process connections and by Servlet
-
getSession
public static Session getSession(int dbId, long sessionId)
Returns an existing session. Used with repeat HTTP connections belonging to the same JDBC Conenction / HSQL Session pair.
-
getDatabase
public static int getDatabase(java.lang.String type, java.lang.String path, Server server, HsqlProperties props)Used by server to open or create a database
-
getDatabase
public static Database getDatabase(int id)
-
shutdownDatabases
public static void shutdownDatabases(Server server, int shutdownMode)
-
getDatabase
public static Database getDatabase(java.lang.String type, java.lang.String path, HsqlProperties props)
This has to be improved once a threading model is in place. Current behaviour: Attempts to connect to different databases do not block. Two db's can open simultaneously. Attempts to connect to a db while it is opening or closing will block until the db is open or closed. At this point the db state is either DATABASE_ONLINE (after db.open() has returned) which allows a new connection to be made, or the state is DATABASE_SHUTDOWN which means the db can be reopened for the new connection).
-
lookupDatabaseObject
public static Database lookupDatabaseObject(java.lang.String type, java.lang.String path)
Looks up database of a given type and path in the registry. Returns null if there is none.
-
deRegisterServer
public static void deRegisterServer(Server server)
Deregisters a server completely.
-
getTimer
public static HsqlTimer getTimer()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG