You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Zili Chen (Jira)" <ji...@apache.org> on 2020/03/05 02:17:00 UTC

[jira] [Updated] (ZOOKEEPER-3497) Make org.apache.zookeeper.jmx.MBeanRegistry a standard singleton

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zili Chen updated ZOOKEEPER-3497:
---------------------------------
    Summary: Make org.apache.zookeeper.jmx.MBeanRegistry a standard singleton  (was: org.apache.zookeeper.jmx.MBeanRegistry 单例 构造函数没有私有化)

> Make org.apache.zookeeper.jmx.MBeanRegistry a standard singleton
> ----------------------------------------------------------------
>
>                 Key: ZOOKEEPER-3497
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3497
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: jmx
>    Affects Versions: 3.6.0
>            Reporter: jwhao
>            Priority: Minor
>
> org.apache.zookeeper.jmx.MBeanRegistry
> 此类使用单例模式实现,项目中其他模块也没有手动new此类,但是此类的构造函数没有私有化
> public MBeanRegistry () {
>     try {
>         mBeanServer = ManagementFactory.getPlatformMBeanServer(); 
>     } catch (Error e) {
>         // Account for running within IKVM and create a new MBeanServer
>         // if the PlatformMBeanServer does not exist.
>         mBeanServer = MBeanServerFactory.createMBeanServer();
>     }
> }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)