public void UnregisterMBeanPermissionTest()
        {
            IMBeanServer server = null;

            DoPermissionTest(
                delegate()
            {
                server = new MBeanServer();
                server.RegisterMBean(new Dummy(), new ObjectName("dummy:"));
            },
                delegate()
            {
                server.UnregisterMBean(new ObjectName("dummy:"));
            }, null, null, MBeanPermissionAction.UnregisterMBean, MBeanPermissionAction.RegisterMBean);
        }
Exemple #2
0
        public static void Unregister(ObjectName mbeanName)
        {
            Log.Debug("Unregistering " + mbeanName);
            MBeanServer mbs = ManagementFactory.GetPlatformMBeanServer();

            if (mbeanName == null)
            {
                Log.Debug("Stacktrace: ", new Exception());
                return;
            }
            try
            {
                mbs.UnregisterMBean(mbeanName);
            }
            catch (Exception e)
            {
                Log.Warn("Error unregistering " + mbeanName, e);
            }
            DefaultMetricsSystem.RemoveMBeanName(mbeanName);
        }
Exemple #3
0
        public static void UnregisterMBean(ObjectName mbeanName)
        {
            MBeanServer mbs = ManagementFactory.GetPlatformMBeanServer();

            if (mbeanName == null)
            {
                return;
            }
            try
            {
                mbs.UnregisterMBean(mbeanName);
            }
            catch (InstanceNotFoundException)
            {
            }
            catch (Exception e)
            {
                // ignore
                Runtime.PrintStackTrace(e);
            }
        }