当前位置: 首页>>代码示例>>Java>>正文


Java ZooKeeperServer.getZKDatabase方法代码示例

本文整理汇总了Java中org.apache.zookeeper.server.ZooKeeperServer.getZKDatabase方法的典型用法代码示例。如果您正苦于以下问题:Java ZooKeeperServer.getZKDatabase方法的具体用法?Java ZooKeeperServer.getZKDatabase怎么用?Java ZooKeeperServer.getZKDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.zookeeper.server.ZooKeeperServer的用法示例。


在下文中一共展示了ZooKeeperServer.getZKDatabase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shutdownServerInstance

import org.apache.zookeeper.server.ZooKeeperServer; //导入方法依赖的package包/类
static void shutdownServerInstance(ServerCnxnFactory factory,
        String hostPort)
{
    if (factory != null) {
        ZKDatabase zkDb;
        {
            ZooKeeperServer zs = getServer(factory);
    
            zkDb = zs.getZKDatabase();
        }
        factory.shutdown();
        try {
            zkDb.close();
        } catch (IOException ie) {
            LOG.warn("Error closing logs ", ie);
        }
        final int PORT = getPort(hostPort);

        Assert.assertTrue("waiting for server down",
                   ClientBaseWithFixes.waitForServerDown("127.0.0.1:" + PORT,
                                                CONNECTION_TIMEOUT));
    }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:ClientBaseWithFixes.java

示例2: shutdownServerInstance

import org.apache.zookeeper.server.ZooKeeperServer; //导入方法依赖的package包/类
static void shutdownServerInstance(ServerCnxnFactory factory,
        String hostPort)
{
    if (factory != null) {
        ZKDatabase zkDb = null;
        {
            ZooKeeperServer zs = getServer(factory);
            if (zs != null) {
                zkDb = zs.getZKDatabase();
            }
        }
        factory.shutdown();
        try {
            if (zkDb != null) {
                zkDb.close();
            }
        } catch (IOException ie) {
            LOG.warn("Error closing logs ", ie);
        }
        final int PORT = getPort(hostPort);

        Assert.assertTrue("waiting for server down",
                   ClientBase.waitForServerDown("127.0.0.1:" + PORT,
                                                CONNECTION_TIMEOUT));
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:27,代码来源:ClientBase.java

示例3: getKey

import org.apache.zookeeper.server.ZooKeeperServer; //导入方法依赖的package包/类
private byte[] getKey(ZooKeeperServer zks) {
    ZKDatabase db = zks.getZKDatabase();
    if (db != null) {
        try {
            Stat stat = new Stat();
            return db.getData("/key", stat, null);
        } catch (NoNodeException e) {
            LOG.error("getData failed", e);
        }
    }
    return null;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:13,代码来源:KeyAuthenticationProvider.java

示例4: shutdownServerInstance

import org.apache.zookeeper.server.ZooKeeperServer; //导入方法依赖的package包/类
static void shutdownServerInstance(ServerCnxnFactory factory,
        String hostPort)
{
    if (factory != null) {
        ZKDatabase zkDb = null;
        {
            ZooKeeperServer zs = getServer(factory);
            if (zs != null) {
                zkDb = zs.getZKDatabase();
            }
        }
        factory.shutdown();
        try {
            if (zkDb != null) {
                zkDb.close();
            }
        } catch (IOException ie) {
            LOG.warn("Error closing logs ", ie);
        }
        final int PORT = getPort(hostPort);

        Assert.assertTrue("waiting for server down",
                   ClientBase.waitForServerDown("127.0.0.1:" + PORT,
                                                CONNECTION_TIMEOUT,
                                                factory.isSecure()));
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:28,代码来源:ClientBase.java

示例5: run

import org.apache.zookeeper.server.ZooKeeperServer; //导入方法依赖的package包/类
@Override
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
    ZKDatabase zkdb = zkServer.getZKDatabase();
    ServerStats stats = zkServer.serverStats();

    CommandResponse response = initializeResponse();

    response.put("version", Version.getFullVersion());

    response.put("avg_latency", stats.getAvgLatency());
    response.put("max_latency", stats.getMaxLatency());
    response.put("min_latency", stats.getMinLatency());

    response.put("packets_received", stats.getPacketsReceived());
    response.put("packets_sent", stats.getPacketsSent());
    response.put("num_alive_connections", stats.getNumAliveClientConnections());

    response.put("outstanding_requests", stats.getOutstandingRequests());

    response.put("server_state", stats.getServerState());
    response.put("znode_count", zkdb.getNodeCount());

    response.put("watch_count", zkdb.getDataTree().getWatchCount());
    response.put("ephemerals_count", zkdb.getDataTree().getEphemeralsCount());
    response.put("approximate_data_size", zkdb.getDataTree().approximateDataSize());

    OSMXBean osMbean = new OSMXBean();
    response.put("open_file_descriptor_count", osMbean.getOpenFileDescriptorCount());
    response.put("max_file_descriptor_count", osMbean.getMaxFileDescriptorCount());

    if (zkServer instanceof LeaderZooKeeperServer) {
        Leader leader = ((LeaderZooKeeperServer) zkServer).getLeader();

        response.put("followers", leader.getLearners().size());
        response.put("synced_followers", leader.getForwardingFollowers().size());
        response.put("pending_syncs", leader.getNumPendingSyncs());
    }

    return response;

}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:42,代码来源:Commands.java


注:本文中的org.apache.zookeeper.server.ZooKeeperServer.getZKDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。