本文整理汇总了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;
}