static void registerServerNotificationListener() {
    if (mbeanServer == null) {
      return;
    }
    try {
      // the MBeanServerDelegate name is spec'ed as the following...
      ObjectName delegate = ObjectName.getInstance("JMImplementation:type=MBeanServerDelegate");
      mbeanServer.addNotificationListener(delegate, (notification, handback) -> {
        MBeanServerNotification serverNotification = (MBeanServerNotification) notification;
        if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION
            .equals(serverNotification.getType())) {
          ObjectName objectName = serverNotification.getMBeanName();
          synchronized (MBeanUtils.managedResources) {
            Object entry = MBeanUtils.managedResources.get(objectName);
            if (entry == null) {
              return;
            }
            if (!(entry instanceof ManagedResource)) {
              throw new ClassCastException(String.format("%s is not a ManagedResource",
                  entry.getClass().getName()));
            }
            ManagedResource resource = (ManagedResource) entry;
            {
              // call cleanup on managedResource
              cleanupResource(resource);
            }
          }
        }
      }, null, null);
    } catch (JMException e) {
      logStackTrace(Level.WARN, e,
          "Failed to register ServerNotificationListener.");
    } catch (JMRuntimeException e) {
      logStackTrace(Level.WARN, e,
          "Failed to register ServerNotificationListener.");
    }
  }
Returns true if the path is on Windows.
geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MBeanUtils.java