public void init()

in services/minho-jmx/src/main/java/org/apache/karaf/minho/jmx/MBeanServerFactory.java [46:73]


    public void init() throws Exception {
        if (this.locateExistingServerIfPossible || this.agentId != null) {
            try {
                List servers = javax.management.MBeanServerFactory.findMBeanServer(agentId);
                if (servers != null && servers.size() > 0) {
                    this.server = (MBeanServer) servers.get(0);
                }
                if (this.server == null && agentId == null) {
                    this.server = ManagementFactory.getPlatformMBeanServer();
                }
                if (this.server == null) {
                    throw new Exception("Unable to locate MBeanServer");
                }
            } catch (Exception e) {
                if (this.agentId != null) {
                    throw e;
                }
            }
        }
        if (this.server == null) {
            if (this.registerWithFactory) {
                this.server = javax.management.MBeanServerFactory.createMBeanServer(this.defaultDomain);
            } else {
                this.server = javax.management.MBeanServerFactory.newMBeanServer(this.defaultDomain);
            }
            this.newlyRegistered = this.registerWithFactory;
        }
    }