RTMPMinaConnection.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:red5-mobileconsole 作者:
protected void registerJMX() {
    // register with jmx
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    try {
        String cName = this.getClass().getName();
        if (cName.indexOf('.') != -1) {
            cName = cName.substring(cName.lastIndexOf('.')).replaceFirst("[\\.]", "");
        }
        String hostStr = host;
        int port = 1935;
        if (host != null && host.indexOf(":") > -1) {
            String[] arr = host.split(":");
            hostStr = arr[0];
            port = Integer.parseInt(arr[1]);
        }
        // Create a new mbean for this instance
        oName = new ObjectName(String.format("org.red5.server:type=%s,connectionType=%s,host=%s,port=%d,clientId=%s", cName, type, hostStr, port, client.getId()));
        if (!mbs.isRegistered(oName)) {
            mbs.registerMBean(new StandardMBean(this, RTMPMinaConnectionMXBean.class, true), oName);
        } else {
            log.debug("Connection is already registered in JMX");
        }
    } catch (Exception e) {
        log.warn("Error on jmx registration", e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号