當前位置: 首頁>>代碼示例>>Java>>正文


Java Notified類代碼示例

本文整理匯總了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);
        }
    }
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:21,代碼來源:DatabaseManager.java

示例2: deRegisterServer

import org.hsqldb.lib.Notified; //導入依賴的package包/類
/**
 * Deregisters a server completely.
 */
public static void deRegisterServer(Notified server) {

    synchronized (serverMap) {
        serverMap.remove(server);
    }
}
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:10,代碼來源:DatabaseManager.java

示例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);
    }
}
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:16,代碼來源:DatabaseManager.java

示例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;
    }
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:16,代碼來源:DatabaseManager.java

示例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);
        }
    }
}
 
開發者ID:topahl,項目名稱:StoryBear,代碼行數:35,代碼來源:DatabaseManager.java

示例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;
}
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:13,代碼來源:DatabaseManager.java


注:本文中的org.hsqldb.lib.Notified類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。