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.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final IntKeyHashMap | databaseIDMap
id number to Database for Databases currently in registry |
| private static AtomicInteger | dbIDCounter
provides unique ID's for the Databases currently in registry |
| pack-priv static final HashMap | fileDatabaseMap
File to Database mapping for file: databases |
| pack-priv static final HashMap | memDatabaseMap
name to Database mapping for mem: databases |
| pack-priv static final HashMap | resDatabaseMap
File to Database mapping for res: databases |
| pack-priv static final HashMap | serverMap
Maintains a map of servers to sets of databases. |
| private static final HsqlTimer |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static synchronized void | |
| public static void | |
| public static void | |
| private static String | |
| public static int | getDatabase(String type, String path, Notified server, HsqlProperties props)
Used by server to open or create a database |
| public static Database | |
| public static Database | getDatabase(String dbtype, String path, HsqlProperties props)
This has to be improved once a threading model is in place. |
| private static synchronized Database | |
| public static HsqlArrayList | |
| public static Session | |
| public static HsqlTimer | |
| pack-priv static boolean | |
| public static synchronized Database | lookupDatabaseObject(DatabaseType type, String path)
Looks up database of a given type and path in the registry. |
| public static Session | newSession(int dbID, String user, String password, String zoneString)
Used by server to open a new session |
| public static Session | newSession(String type, String path, String user, String password, HsqlProperties props, TimeZone zone)
Used by in-process connections and by Servlet |
| private static void | notifyServers(Database db)
Notifies all servers that serve the database that the database has been shutdown. |
| private static void | |
| pack-priv static void | |
| public static void |
| databaseIDMap | back to summary |
|---|---|
| pack-priv static final IntKeyHashMap<Database> databaseIDMap id number to Database for Databases currently in registry | |
| dbIDCounter | back to summary |
|---|---|
| private static AtomicInteger dbIDCounter provides unique ID's for the Databases currently in registry | |
| fileDatabaseMap | back to summary |
|---|---|
| pack-priv static final HashMap<String, Database> fileDatabaseMap File to Database mapping for file: databases | |
| memDatabaseMap | back to summary |
|---|---|
| pack-priv static final HashMap<String, Database> memDatabaseMap name to Database mapping for mem: databases | |
| resDatabaseMap | back to summary |
|---|---|
| pack-priv static final HashMap<String, Database> resDatabaseMap File to Database mapping for res: databases | |
| serverMap | back to summary |
|---|---|
| pack-priv static final HashMap<Notified, HashSet<Database>> serverMap Maintains a map of servers to sets of databases. Servers register each of their databases. When a database is shutdown, all the servers accessing it are notified. The database is then removed form the sets for all servers and the servers that have no other database are removed from the map. | |
| timer | back to summary |
|---|---|
| private static final HsqlTimer timer | |
| DatabaseManager | back to summary |
|---|---|
| public DatabaseManager() | |
| addDatabaseObject | back to summary |
|---|---|
| private static synchronized void addDatabaseObject(DatabaseType type, String path, Database db) Adds a database to the registry. | |
| closeDatabases | back to summary |
|---|---|
| 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; | |
| deRegisterServer | back to summary |
|---|---|
| public static void deRegisterServer(Notified server) Deregisters a server completely. | |
| filePathToKey | back to summary |
|---|---|
| private static String filePathToKey(String path) | |
| getDatabase | back to summary |
|---|---|
| public static int getDatabase(String type, String path, Notified server, HsqlProperties props) Used by server to open or create a database | |
| getDatabase | back to summary |
|---|---|
| public static Database getDatabase(int id) | |
| getDatabase | back to summary |
|---|---|
| public static Database getDatabase(String dbtype, 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. | |
| getDatabaseObject | back to summary |
|---|---|
| private static synchronized Database getDatabaseObject(DatabaseType type, String path, HsqlProperties props) | |
| getDatabaseURIs | back to summary |
|---|---|
| public static HsqlArrayList Returns a list containing the URI (type + path) for all the databases. | |
| getSession | back to summary |
|---|---|
| public static Session getSession(int dbId, long sessionId) Returns an existing session. Used with repeat HTTP connections belonging to the same JDBC Connection / HSQL Session pair. | |
| getTimer | back to summary |
|---|---|
| public static HsqlTimer getTimer() | |
| isServerDB | back to summary |
|---|---|
| pack-priv static boolean isServerDB(Database db) | |
| lookupDatabaseObject | back to summary |
|---|---|
| public static synchronized Database lookupDatabaseObject(DatabaseType type, String path) Looks up database of a given type and path in the registry. Returns null if there is none. | |
| newSession | back to summary |
|---|---|
| public static Session newSession(int dbID, String user, String password, String zoneString) Used by server to open a new session | |
| newSession | back to summary |
|---|---|
| public static Session newSession(String type, String path, String user, String password, HsqlProperties props, TimeZone zone) Used by in-process connections and by Servlet | |
| notifyServers | back to summary |
|---|---|
| private static void notifyServers(Database db) Notifies all servers that serve the database that the database has been shutdown. | |
| registerServer | back to summary |
|---|---|
| private static void registerServer(Notified server, Database db) Registers a server as serving a given database. | |
| removeDatabase | back to summary |
|---|---|
| pack-priv static void removeDatabase(Database database) Removes the database from registry. | |
| shutdownDatabases | back to summary |
|---|---|
| public static void shutdownDatabases(Notified server, int shutdownMode) | |