本文整理匯總了Java中org.hsqldb.lib.Notified類的典型用法代碼示例。如果您正苦於以下問題:Java Notified類的具體用法?Java Notified怎麽用?Java Notified使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Notified類屬於org.hsqldb.lib包,在下文中一共展示了Notified類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shutdownDatabases
import org.hsqldb.lib.Notified; //導入依賴的package包/類
public static void shutdownDatabases(Notified server, int shutdownMode) {
Database[] dbArray;
synchronized (serverMap) {
HashSet databases = (HashSet) serverMap.get(server);
if (databases == null) {
dbArray = new Database[0];
} else {
dbArray = new Database[databases.size()];
databases.toArray(dbArray);
}
}
for (int i = 0; i < dbArray.length; i++) {
dbArray[i].close(shutdownMode);
}
}
示例2: deRegisterServer
import org.hsqldb.lib.Notified; //導入依賴的package包/類
/**
* Deregisters a server completely.
*/
public static void deRegisterServer(Notified server) {
synchronized (serverMap) {
serverMap.remove(server);
}
}
示例3: registerServer
import org.hsqldb.lib.Notified; //導入依賴的package包/類
/**
* Registers a server as serving a given database.
*/
private static void registerServer(Notified server, Database db) {
synchronized (serverMap) {
if (!serverMap.containsKey(server)) {
serverMap.put(server, new HashSet());
}
HashSet databases = (HashSet) serverMap.get(server);
databases.add(db);
}
}
示例4: isServerDB
import org.hsqldb.lib.Notified; //導入依賴的package包/類
static boolean isServerDB(Database db) {
Iterator it = serverMap.keySet().iterator();
for (; it.hasNext(); ) {
Notified server = (Notified) it.next();
HashSet databases = (HashSet) serverMap.get(server);
if (databases.contains(db)) {
return true;
}
}
return false;
}
示例5: notifyServers
import org.hsqldb.lib.Notified; //導入依賴的package包/類
/**
* Notifies all servers that serve the database that the database has been
* shutdown.
*/
private static void notifyServers(Database db) {
Notified[] servers;
synchronized (serverMap) {
servers = new Notified[serverMap.size()];
serverMap.keysToArray(servers);
}
for (int i = 0; i < servers.length; i++) {
Notified server = servers[i];
HashSet databases;
boolean removed = false;
synchronized (serverMap) {
databases = (HashSet) serverMap.get(server);
}
if (databases != null) {
synchronized (databases) {
removed = databases.remove(db);
}
}
if (removed) {
server.notify(db.databaseID);
}
}
}
示例6: getDatabase
import org.hsqldb.lib.Notified; //導入依賴的package包/類
/**
* Used by server to open or create a database
*/
public static int getDatabase(String type, String path, Notified server,
HsqlProperties props) {
Database db = getDatabase(type, path, props);
registerServer(server, db);
return db.databaseID;
}