Java 类org.apache.zookeeper.jmx.MBeanRegistry 实例源码

项目:incubator-twill    文件:SessionExpireTestRun.java   
private boolean expireAppMasterZKSession(TwillController controller, long timeout, TimeUnit timeoutUnit) {
  MBeanServer mbeanServer = MBeanRegistry.getInstance().getPlatformMBeanServer();
  QueryExp query = Query.isInstanceOf(new StringValueExp(ConnectionMXBean.class.getName()));

  Stopwatch stopwatch = new Stopwatch();

  do {
    // Find the AM session and expire it
    Set<ObjectName> connectionBeans = mbeanServer.queryNames(ObjectName.WILDCARD, query);
    for (ObjectName objectName : connectionBeans) {

      ConnectionMXBean connectionBean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName,
                                                                                      ConnectionMXBean.class, false);
      for (String node : connectionBean.getEphemeralNodes()) {
        if (node.endsWith("/instances/" + controller.getRunId().getId())) {
          // This is the AM, expire the session.
          LOG.info("Kill AM session {}", connectionBean.getSessionId());
          connectionBean.terminateSession();
          return true;
        }
      }
    }
  } while (stopwatch.elapsedTime(timeoutUnit) < timeout);

  return false;
}
项目:fuck_zookeeper    文件:LearnerZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:fuck_zookeeper    文件:LearnerZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:fuck_zookeeper    文件:LearnerZooKeeperServer.java   
protected void unregisterJMX(Learner peer) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:fuck_zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:fuck_zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:fuck_zookeeper    文件:LeaderZooKeeperServer.java   
protected void unregisterJMX(Leader leader) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:fuck_zookeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:fuck_zookeeper    文件:ReadOnlyZooKeeperServer.java   
public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean) {
    // register with JMX
    try {
        jmxServerBean = serverBean;
        MBeanRegistry.getInstance().register(serverBean, localPeerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxServerBean = null;
    }
}
项目:fuck_zookeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:fuck_zookeeper    文件:ReadOnlyZooKeeperServer.java   
protected void unregisterJMX(ZooKeeperServer zks) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:fuck_zookeeper    文件:ServerCnxnFactory.java   
public void registerConnection(ServerCnxn serverCnxn) {
    if (zkServer != null) {
        ConnectionBean jmxConnectionBean = new ConnectionBean(serverCnxn, zkServer);
        try {
            MBeanRegistry.getInstance().register(jmxConnectionBean, zkServer.jmxServerBean);
            connectionBeans.put(serverCnxn, jmxConnectionBean);
        } catch (JMException e) {
            LOG.warn("Could not register connection", e);
        }
    }

}
项目:fuck_zookeeper    文件:JMXEnv.java   
public static void setUp() throws IOException {
    MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer();

    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
    cs.start();

   JMXServiceURL addr = cs.getAddress();

   cc = JMXConnectorFactory.connect(addr);
}
项目:https-github.com-apache-zookeeper    文件:LearnerZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:https-github.com-apache-zookeeper    文件:LearnerZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:https-github.com-apache-zookeeper    文件:LearnerZooKeeperServer.java   
protected void unregisterJMX(Learner peer) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:https-github.com-apache-zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:https-github.com-apache-zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:https-github.com-apache-zookeeper    文件:LeaderZooKeeperServer.java   
protected void unregisterJMX(Leader leader) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:https-github.com-apache-zookeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:https-github.com-apache-zookeeper    文件:ReadOnlyZooKeeperServer.java   
public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean) {
    // register with JMX
    try {
        jmxServerBean = serverBean;
        MBeanRegistry.getInstance().register(serverBean, localPeerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxServerBean = null;
    }
}
项目:https-github.com-apache-zookeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:https-github.com-apache-zookeeper    文件:ReadOnlyZooKeeperServer.java   
protected void unregisterJMX(ZooKeeperServer zks) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:https-github.com-apache-zookeeper    文件:ServerCnxnFactory.java   
public void registerConnection(ServerCnxn serverCnxn) {
    if (zkServer != null) {
        ConnectionBean jmxConnectionBean = new ConnectionBean(serverCnxn, zkServer);
        try {
            MBeanRegistry.getInstance().register(jmxConnectionBean, zkServer.jmxServerBean);
            connectionBeans.put(serverCnxn, jmxConnectionBean);
        } catch (JMException e) {
            LOG.warn("Could not register connection", e);
        }
    }

}
项目:https-github.com-apache-zookeeper    文件:JMXEnv.java   
public static void setUp() throws IOException {
    MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer();

    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://127.0.0.1");
    cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
    cs.start();

   JMXServiceURL addr = cs.getAddress();

   cc = JMXConnectorFactory.connect(addr);
}
项目:ZooKeeper    文件:LearnerZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:ZooKeeper    文件:LearnerZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:ZooKeeper    文件:LearnerZooKeeperServer.java   
protected void unregisterJMX(Learner peer) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:ZooKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:ZooKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:ZooKeeper    文件:LeaderZooKeeperServer.java   
protected void unregisterJMX(Leader leader) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:ZooKeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:ZooKeeper    文件:ReadOnlyZooKeeperServer.java   
public void registerJMX(ZooKeeperServerBean serverBean, LocalPeerBean localPeerBean) {
    // register with JMX
    try {
        jmxServerBean = serverBean;
        MBeanRegistry.getInstance().register(serverBean, localPeerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxServerBean = null;
    }
}
项目:ZooKeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:ZooKeeper    文件:ReadOnlyZooKeeperServer.java   
protected void unregisterJMX(ZooKeeperServer zks) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}
项目:ZooKeeper    文件:ServerCnxnFactory.java   
public void registerConnection(ServerCnxn serverCnxn) {
    if (zkServer != null) {
        ConnectionBean jmxConnectionBean = new ConnectionBean(serverCnxn, zkServer);
        try {
            MBeanRegistry.getInstance().register(jmxConnectionBean, zkServer.jmxServerBean);
            connectionBeans.put(serverCnxn, jmxConnectionBean);
        } catch (JMException e) {
            LOG.warn("Could not register connection", e);
        }
    }

}
项目:ZooKeeper    文件:JMXEnv.java   
public static void setUp() throws IOException {
    MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer();

    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
    cs.start();

   JMXServiceURL addr = cs.getAddress();

   cc = JMXConnectorFactory.connect(addr);
}
项目:StreamProcessingInfrastructure    文件:LearnerZooKeeperServer.java   
@Override
protected void registerJMX() {
    // register with JMX
    try {
        jmxDataTreeBean = new DataTreeBean(getZKDatabase().getDataTree());
        MBeanRegistry.getInstance().register(jmxDataTreeBean, jmxServerBean);
    } catch (Exception e) {
        LOG.warn("Failed to register with JMX", e);
        jmxDataTreeBean = null;
    }
}
项目:StreamProcessingInfrastructure    文件:LearnerZooKeeperServer.java   
@Override
protected void unregisterJMX() {
    // unregister from JMX
    try {
        if (jmxDataTreeBean != null) {
            MBeanRegistry.getInstance().unregister(jmxDataTreeBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxDataTreeBean = null;
}
项目:StreamProcessingInfrastructure    文件:LearnerZooKeeperServer.java   
protected void unregisterJMX(Learner peer) {
    // unregister from JMX
    try {
        if (jmxServerBean != null) {
            MBeanRegistry.getInstance().unregister(jmxServerBean);
        }
    } catch (Exception e) {
        LOG.warn("Failed to unregister with JMX", e);
    }
    jmxServerBean = null;
}