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); }
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); }
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); } }