当前位置: 首页>>代码示例>>Java>>正文


Java MBeanServerFactory.releaseMBeanServer方法代码示例

本文整理汇总了Java中javax.management.MBeanServerFactory.releaseMBeanServer方法的典型用法代码示例。如果您正苦于以下问题:Java MBeanServerFactory.releaseMBeanServer方法的具体用法?Java MBeanServerFactory.releaseMBeanServer怎么用?Java MBeanServerFactory.releaseMBeanServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.MBeanServerFactory的用法示例。


在下文中一共展示了MBeanServerFactory.releaseMBeanServer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: destroy

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
/**
 * Unregisters the {@code MBeanServer} instance, if necessary.
 */
@Override
public void destroy() {
	if (this.newlyRegistered) {
		MBeanServerFactory.releaseMBeanServer(this.server);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:MBeanServerFactoryBean.java

示例2: releaseMBeanServer

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
/**
 * Unregisters all GemFire MBeans and then releases the MBeanServer for garbage collection.
 */
static void releaseMBeanServer() {
  try {
    // unregister all GemFire mbeans...
    Iterator iter = mbeanServer.queryNames(null, null).iterator();
    while (iter.hasNext()) {
      ObjectName name = (ObjectName) iter.next();
      if (name.getDomain().startsWith(DEFAULT_DOMAIN)) {
        unregisterMBean(name);
      }
    }

    // last, release the mbean server...
    MBeanServerFactory.releaseMBeanServer(mbeanServer);
    mbeanServer = null;
  } catch (JMRuntimeException e) {
    logStackTrace(Level.WARN, e);
  }
  /*
   * See #42391. Cleaning up the static maps which might be still holding references to
   * ManagedResources
   */
  synchronized (MBeanUtil.managedResources) {
    MBeanUtil.managedResources.clear();
  }
  synchronized (refreshClients) {
    refreshClients.clear();
  }
  /*
   * See #42391. Cleaning up the static maps which might be still holding references to
   * ManagedResources
   */
  synchronized (MBeanUtil.managedResources) {
    MBeanUtil.managedResources.clear();
  }
  synchronized (refreshClients) {
    refreshClients.clear();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:42,代码来源:MBeanUtil.java

示例3: close

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
/**
 * Abort open transactions and unregister read only modules. Since this class is
 * not responsible for registering itself under
 * {@link org.opendaylight.controller.config.api.ConfigRegistry#OBJECT_NAME}, it
 * will not unregister itself here.
 */
@Override
public void close() {
    if (!closed.compareAndSet(false, true)) {
        return;
    }

    // abort transactions
    Map<String, Entry<ConfigTransactionControllerInternal, ConfigTransactionLookupRegistry>> transactions =
            transactionsHolder.getCurrentTransactions();
    for (Entry<ConfigTransactionControllerInternal, ConfigTransactionLookupRegistry>
        configTransactionControllerEntry : transactions.values()) {
        ConfigTransactionControllerInternal configTransactionController = configTransactionControllerEntry.getKey();
        configTransactionControllerEntry.getValue().close();
        configTransactionController.abortConfig();
    }

    // destroy all live objects one after another in order of the dependency
    // hierarchy, from top to bottom
    List<DestroyedModule> destroyedModules = currentConfig.getModulesToBeDestroyed();

    LOG.info("ConfigRegistry closing - destroying {} modules", destroyedModules.size());

    for (DestroyedModule destroyedModule : destroyedModules) {
        destroyedModule.close();
    }
    // unregister MBeans that failed to unregister properly
    baseJMXRegistrator.close();
    // remove jmx servers
    MBeanServerFactory.releaseMBeanServer(registryMBeanServer);
    MBeanServerFactory.releaseMBeanServer(transactionsMBeanServer);

    LOG.info("ConfigRegistry closed");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:40,代码来源:ConfigRegistryImpl.java

示例4: main

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        boolean error = false;

        // Instantiate the MBean server
        //
        System.out.println("Create the MBean server");
        MBeanServer mbs = MBeanServerFactory.createMBeanServer();

        // Instantiate an MLet
        //
        System.out.println("Create the MLet");
        MLet mlet = new MLet();

        // Register the MLet MBean with the MBeanServer
        //
        System.out.println("Register the MLet MBean");
        ObjectName mletObjectName = new ObjectName("Test:type=MLet");
        mbs.registerMBean(mlet, mletObjectName);

        // Call getMBeansFromURL
        //
        System.out.println("Call mlet.getMBeansFromURL(<url>)");
        String testSrc = System.getProperty("test.src");
        System.out.println("test.src = " + testSrc);
        String urlCodebase;
        if (testSrc.startsWith("/")) {
            urlCodebase =
                "file:" + testSrc.replace(File.separatorChar, '/') + "/";
        } else {
            urlCodebase =
                "file:/" + testSrc.replace(File.separatorChar, '/') + "/";
        }
        String mletFile = urlCodebase + args[0];
        System.out.println("MLet File = " + mletFile);
        try {
            mlet.getMBeansFromURL(mletFile);
            System.out.println(
                "TEST FAILED: Expected ServiceNotFoundException not thrown");
            error = true;
        } catch (ServiceNotFoundException e) {
            if (e.getCause() == null) {
                System.out.println("TEST FAILED: Got unexpected null cause " +
                    "in ServiceNotFoundException");
                error = true;
            } else if (!(e.getCause() instanceof IOException)) {
                System.out.println("TEST FAILED: Got unexpected non-null " +
                    "cause in ServiceNotFoundException");
                error = true;
            } else {
                System.out.println("TEST PASSED: Got expected non-null " +
                    "cause in ServiceNotFoundException");
                error = false;
            }
            e.printStackTrace(System.out);
        }

        // Unregister the MLet MBean
        //
        System.out.println("Unregister the MLet MBean");
        mbs.unregisterMBean(mletObjectName);

        // Release MBean server
        //
        System.out.println("Release the MBean server");
        MBeanServerFactory.releaseMBeanServer(mbs);

        // End Test
        //
        System.out.println("Bye! Bye!");
        if (error) System.exit(1);
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:73,代码来源:ParserInfiniteLoopTest.java

示例5: main

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        boolean error = false;

        // Instantiate the MBean server
        //
        System.out.println("Create the MBean server");
        MBeanServer mbs = MBeanServerFactory.createMBeanServer();

        // Instantiate an MLet
        //
        System.out.println("Create the MLet");
        MLet mlet = new MLet();

        // Register the MLet MBean with the MBeanServer
        //
        System.out.println("Register the MLet MBean");
        ObjectName mletObjectName = new ObjectName("Test:type=MLet");
        mbs.registerMBean(mlet, mletObjectName);

        // Call getMBeansFromURL
        //
        System.out.println("Call mlet.getMBeansFromURL(<url>)");
        try {
            mlet.getMBeansFromURL("bogus://whatever");
            System.out.println("TEST FAILED: Expected " +
                               ServiceNotFoundException.class +
                               " exception not thrown.");
            error = true;
        } catch (ServiceNotFoundException e) {
            if (e.getCause() == null) {
                System.out.println("TEST FAILED: Got null cause in " +
                                   ServiceNotFoundException.class +
                                   " exception.");
                error = true;
            } else {
                System.out.println("TEST PASSED: Got non-null cause in " +
                                   ServiceNotFoundException.class +
                                   " exception.");
                error = false;
            }
            e.printStackTrace(System.out);
        }

        // Unregister the MLet MBean
        //
        System.out.println("Unregister the MLet MBean");
        mbs.unregisterMBean(mletObjectName);

        // Release MBean server
        //
        System.out.println("Release the MBean server");
        MBeanServerFactory.releaseMBeanServer(mbs);

        // End Test
        //
        System.out.println("Bye! Bye!");
        if (error) System.exit(1);
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:60,代码来源:GetMBeansFromURLTest.java

示例6: test

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
private static void test(String proto) throws Exception {
    System.out.println("Unexpected notifications test for protocol " +
                       proto);
    MBeanServer mbs = null;
    try {
        // Create a MBeanServer
        //
        mbs = MBeanServerFactory.createMBeanServer();

        // Create a NotificationEmitter MBean
        //
        mbean = new ObjectName ("Default:name=NotificationEmitter");
        mbs.registerMBean(new NotificationEmitter(), mbean);

        // Create a connector server
        //
        url = new JMXServiceURL("service:jmx:" + proto + "://");

        server = JMXConnectorServerFactory.newJMXConnectorServer(url,
                                                                 null,
                                                                 mbs);

        mbs.registerMBean(
                    server,
                    new ObjectName("Default:name=ConnectorServer"));

        server.start();

        url = server.getAddress();

        for (int j = 0; j < 2; j++) {
            test();
        }
    } finally {
        // Stop server
        //
        server.stop();
        // Release the MBeanServer
        //
        MBeanServerFactory.releaseMBeanServer(mbs);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:43,代码来源:UnexpectedNotifTest.java

示例7: main

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        boolean error = false;

        // Instantiate the MBean server
        //
        System.out.println("Create the MBean server");
        MBeanServer mbs = MBeanServerFactory.createMBeanServer();

        // Get Default Locale
        Locale loc = Locale.getDefault();

        // Instantiate an MLet
        //
        System.out.println("Create the MLet");
        MLet mlet = new MLet();

        // Register the MLet MBean with the MBeanServer
        //
        System.out.println("Register the MLet MBean");
        ObjectName mletObjectName = new ObjectName("Test:type=MLet");
        mbs.registerMBean(mlet, mletObjectName);

        // Call getMBeansFromURL
        //
        System.out.println("Call mlet.getMBeansFromURL(<url>)");
        String testSrc = System.getProperty("test.src");
        System.out.println("test.src = " + testSrc);
        String urlCodebase;
        if (testSrc.startsWith("/")) {
            urlCodebase =
                "file:" + testSrc.replace(File.separatorChar, '/') + "/";
        } else {
            urlCodebase =
                "file:/" + testSrc.replace(File.separatorChar, '/') + "/";
        }
        String mletFile = urlCodebase + args[0];
        System.out.println("MLet File = " + mletFile);
        try {
            // Change default Locale to Turkish
            Locale.setDefault(new Locale("tr", "TR"));
            mlet.getMBeansFromURL(mletFile);
            System.out.println("Test Passes");
        } catch (Exception e) {
            error = true;
            e.printStackTrace(System.out);
        }finally {
            Locale.setDefault(loc);
        }

        // Unregister the MLet MBean
        //
        System.out.println("Unregister the MLet MBean");
        mbs.unregisterMBean(mletObjectName);

        // Release MBean server
        //
        System.out.println("Release the MBean server");
        MBeanServerFactory.releaseMBeanServer(mbs);

        // End Test
        //
        System.out.println("Bye! Bye!");
        if (error) System.exit(1);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:66,代码来源:MletParserLocaleTest.java

示例8: unregisterFromJMX

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
@After
public void unregisterFromJMX() throws Exception {
    TestingFixedThreadPool.cleanUp();
    platformMBeanServer.unregisterMBean(threadPoolDynamicWrapperON);
    MBeanServerFactory.releaseMBeanServer(internalServer);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:AbstractDynamicWrapperTest.java

示例9: cleanUp

import javax.management.MBeanServerFactory; //导入方法依赖的package包/类
@After
public void cleanUp() {
    baseJMXRegistrator.close();
    MBeanServerFactory.releaseMBeanServer(transactionsMBeanServer);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:ConfigTransactionControllerImplTest.java


注:本文中的javax.management.MBeanServerFactory.releaseMBeanServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。