当前位置: 首页>>代码示例>>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;未经允许,请勿转载。