AbstractMBeanServerExecutor implements MBeanServerExecutor, NotificationListener { public void unregisterFromMBeanNotifications() { Set<MBeanServerConnection> servers = getMBeanServers(); Exception lastExp = null; StringBuilder errors = new StringBuilder(); for (MBeanServerConnection server : servers) { try { JmxUtil.removeMBeanRegistrationListener(server,this); } catch (IllegalStateException e) { lastExp = updateErrorMsg(errors, e); } } if (lastExp != null) { throw new IllegalStateException(errors.substring(0,errors.length()-1),lastExp); } }  void each(ObjectName pObjectName, MBeanEachCallback pCallback); T call(ObjectName pObjectName, MBeanAction<T> pMBeanAction, Object ... pExtraArgs); Set<ObjectName> queryNames(ObjectName pObjectName); void unregisterFromMBeanNotifications(); void handleNotification(Notification pNotification, Object pHandback); boolean hasMBeansListChangedSince(long pTimestamp);  }
@Test public void destroyWithoutPriorRegistration() throws NoSuchFieldException, IllegalAccessException { executor.unregisterFromMBeanNotifications(); }