本文整理汇总了Java中org.apache.zookeeper.server.util.OSMXBean类的典型用法代码示例。如果您正苦于以下问题:Java OSMXBean类的具体用法?Java OSMXBean怎么用?Java OSMXBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OSMXBean类属于org.apache.zookeeper.server.util包,在下文中一共展示了OSMXBean类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: tearDown
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Override
public void tearDown() throws Exception {
LOG.info("TearDown started");
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == true) {
LOG.info("fdcount after test is: "
+ osMbean.getOpenFileDescriptorCount());
}
shutdownServers();
for (String hp : hostPort.split(",")) {
Assert.assertTrue("waiting for server down",
ClientBase.waitForServerDown(hp,
ClientBase.CONNECTION_TIMEOUT));
LOG.info(hp + " is no longer accepting client connections");
}
JMXEnv.tearDown();
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:22,代码来源:QuorumBase.java
示例2: setUp
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
/* some useful information - log the number of fds used before
* and after a test is run. Helps to verify we are freeing resources
* correctly. Unfortunately this only works on unix systems (the
* only place sun has implemented as part of the mgmt bean api.
*/
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == true) {
initialFdCount = osMbean.getOpenFileDescriptorCount();
LOG.info("Initial fdcount is: "
+ initialFdCount);
}
setupTestEnv();
JMXEnv.setUp();
setUpAll();
tmpDir = createTmpDir(BASETEST);
startServer();
LOG.info("Client test setup finished");
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:27,代码来源:ClientBase.java
示例3: setUp
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
/* some useful information - log the number of fds used before
* and after a test is run. Helps to verify we are freeing resources
* correctly. Unfortunately this only works on unix systems (the
* only place sun has implemented as part of the mgmt bean api.
*/
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == true) {
initialFdCount = osMbean.getOpenFileDescriptorCount();
LOG.info("Initial fdcount is: "
+ initialFdCount);
}
setupTestEnv();
JMXEnv.setUp();
setUpAll();
tmpDir = createTmpDir(BASETEST, true);
startServer();
LOG.info("Client test setup finished");
}
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:27,代码来源:ClientBase.java
示例4: tearDown
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
public void tearDown() throws Exception {
LOG.info("TearDown started");
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == true) {
LOG.info("fdcount after test is: " + osMbean.getOpenFileDescriptorCount());
}
shutdownAll();
JMXEnv.tearDown();
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:12,代码来源:QuorumUtil.java
示例5: tearDown
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
LOG.info("tearDown starting");
tearDownAll();
stopServer();
if (tmpDir != null) {
Assert.assertTrue("delete " + tmpDir.toString(), recursiveDelete(tmpDir));
}
// This has to be set to null when the same instance of this class is reused between test cases
serverFactory = null;
JMXEnv.tearDown();
/* some useful information - log the number of fds used before
* and after a test is run. Helps to verify we are freeing resources
* correctly. Unfortunately this only works on unix systems (the
* only place sun has implemented as part of the mgmt bean api.
*/
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == true) {
long fdCount = osMbean.getOpenFileDescriptorCount();
String message = "fdcount after test is: "
+ fdCount + " at start it was " + initialFdCount;
LOG.info(message);
if (fdCount > initialFdCount) {
LOG.info("sleeping for 20 secs");
//Thread.sleep(60000);
//assertTrue(message, fdCount <= initialFdCount);
}
}
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:36,代码来源:ClientBase.java
示例6: testFileDescriptorLeak
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Test
public void testFileDescriptorLeak() throws Exception {
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() != true) {
LOG.info("Unable to run test on non-unix system");
return;
}
long startFdCount = osMbean.getOpenFileDescriptorCount();
LOG.info("Start fdcount is: " + startFdCount);
for (int i = 0; i < 50; ++i) {
NIOServerCnxnFactory factory = new NIOServerCnxnFactory();
factory.configure(
new InetSocketAddress(
"127.0.0.1", PortAssignment.unique()), 10);
factory.start();
Thread.sleep(100);
factory.shutdown();
}
long endFdCount = osMbean.getOpenFileDescriptorCount();
LOG.info("End fdcount is: " + endFdCount);
// On my box, if selector.close() is not called fd diff is > 700.
Assert.assertTrue("Possible fd leakage",
((endFdCount - startFdCount) < 50));
}
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:30,代码来源:NIOConnectionFactoryFdLeakTest.java
示例7: commandRun
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Override
public void commandRun() {
if(zkServer == null) {
pw.println(ZK_NOT_SERVING);
return;
}
ZKDatabase zkdb = zkServer.getZKDatabase();
ServerStats stats = zkServer.serverStats();
print("version", Version.getFullVersion());
print("avg_latency", stats.getAvgLatency());
print("max_latency", stats.getMaxLatency());
print("min_latency", stats.getMinLatency());
print("packets_received", stats.getPacketsReceived());
print("packets_sent", stats.getPacketsSent());
print("num_alive_connections", stats.getNumAliveClientConnections());
print("outstanding_requests", stats.getOutstandingRequests());
print("server_state", stats.getServerState());
print("znode_count", zkdb.getNodeCount());
print("watch_count", zkdb.getDataTree().getWatchCount());
print("ephemerals_count", zkdb.getDataTree().getEphemeralsCount());
print("approximate_data_size", zkdb.getDataTree().approximateDataSize());
OSMXBean osMbean = new OSMXBean();
if (osMbean != null && osMbean.getUnix() == true) {
print("open_file_descriptor_count", osMbean.getOpenFileDescriptorCount());
print("max_file_descriptor_count", osMbean.getMaxFileDescriptorCount());
}
if(stats.getServerState().equals("leader")) {
Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader();
print("followers", leader.getLearners().size());
print("synced_followers", leader.getForwardingFollowers().size());
print("pending_syncs", leader.getNumPendingSyncs());
}
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:43,代码来源:NettyServerCnxn.java
示例8: commandRun
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Override
public void commandRun() {
if(zkServer == null) {
pw.println(ZK_NOT_SERVING);
return;
}
ZKDatabase zkdb = zkServer.getZKDatabase();
ServerStats stats = zkServer.serverStats();
print("version", Version.getFullVersion());
print("avg_latency", stats.getAvgLatency());
print("max_latency", stats.getMaxLatency());
print("min_latency", stats.getMinLatency());
print("packets_received", stats.getPacketsReceived());
print("packets_sent", stats.getPacketsSent());
print("num_alive_connections", stats.getNumAliveClientConnections());
print("outstanding_requests", stats.getOutstandingRequests());
print("server_state", stats.getServerState());
print("znode_count", zkdb.getNodeCount());
print("watch_count", zkdb.getDataTree().getWatchCount());
print("ephemerals_count", zkdb.getDataTree().getEphemeralsCount());
print("approximate_data_size", zkdb.getDataTree().approximateDataSize());
OSMXBean osMbean = new OSMXBean();
if (osMbean != null && osMbean.getUnix() == true) {
print("open_file_descriptor_count", osMbean.getOpenFileDescriptorCount());
print("max_file_descriptor_count", osMbean.getMaxFileDescriptorCount());
}
if(stats.getServerState().equals("leader")) {
Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader();
print("followers", leader.getLearners().size());
print("synced_followers", leader.getForwardingFollowers().size());
print("pending_syncs", leader.getNumPendingSyncs());
}
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:43,代码来源:NIOServerCnxn.java
示例9: initialize
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
@Before
public void initialize() {
this.osMbean = new OSMXBean();
Assert.assertNotNull("Could not initialize OSMXBean object!", osMbean);
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:6,代码来源:OSMXBeanTest.java
示例10: testClientCleanup
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
/**
* Verify that the client is cleaning up properly. Open/close a large
* number of sessions. Essentially looking to see if sockets/selectors
* are being cleaned up properly during close.
*
* @throws Throwable
*/
@Test
public void testClientCleanup() throws Throwable {
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == false) {
LOG.warn("skipping testClientCleanup, only available on Unix");
return;
}
final int threadCount = 3;
final int clientCount = 10;
/* Log the number of fds used before and after a test is run. Verifies
* we are freeing resources correctly. Unfortunately this only works
* on unix systems (the only place sun has implemented as part of the
* mgmt bean api).
*/
long initialFdCount = osMbean.getOpenFileDescriptorCount();
VerifyClientCleanup threads[] = new VerifyClientCleanup[threadCount];
for (int i = 0; i < threads.length; i++) {
threads[i] = new VerifyClientCleanup("VCC" + i, clientCount);
threads[i].start();
}
for (int i = 0; i < threads.length; i++) {
threads[i].join(CONNECTION_TIMEOUT);
Assert.assertTrue(threads[i].current == threads[i].count);
}
// if this Assert.fails it means we are not cleaning up after the closed
// sessions.
long currentCount = osMbean.getOpenFileDescriptorCount();
final String logmsg = "open fds after test ({}) are not significantly higher than before ({})";
if (currentCount > initialFdCount + 10) {
// consider as error
LOG.error(logmsg,Long.valueOf(currentCount),Long.valueOf(initialFdCount));
} else {
LOG.info(logmsg,Long.valueOf(currentCount),Long.valueOf(initialFdCount));
}
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:50,代码来源:ClientTest.java
示例11: setUp
import org.apache.zookeeper.server.util.OSMXBean; //导入依赖的package包/类
protected void setUp(boolean withObservers) throws Exception {
LOG.info("QuorumBase.setup " + getTestName());
setupTestEnv();
JMXEnv.setUp();
setUpAll();
port1 = PortAssignment.unique();
port2 = PortAssignment.unique();
port3 = PortAssignment.unique();
port4 = PortAssignment.unique();
port5 = PortAssignment.unique();
portLE1 = PortAssignment.unique();
portLE2 = PortAssignment.unique();
portLE3 = PortAssignment.unique();
portLE4 = PortAssignment.unique();
portLE5 = PortAssignment.unique();
hostPort = "127.0.0.1:" + port1
+ ",127.0.0.1:" + port2
+ ",127.0.0.1:" + port3
+ ",127.0.0.1:" + port4
+ ",127.0.0.1:" + port5;
LOG.info("Ports are: " + hostPort);
s1dir = ClientBase.createTmpDir();
s2dir = ClientBase.createTmpDir();
s3dir = ClientBase.createTmpDir();
s4dir = ClientBase.createTmpDir();
s5dir = ClientBase.createTmpDir();
startServers(withObservers);
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == true) {
LOG.info("Initial fdcount is: "
+ osMbean.getOpenFileDescriptorCount());
}
LOG.info("Setup finished");
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:44,代码来源:QuorumBase.java
注:本文中的org.apache.zookeeper.server.util.OSMXBean类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论