code: @FFDCIgnore(IllegalStateException.class)
      private void updateMonitorService() {
          if ( !coveringPaths.isEmpty() ) {
              if ( service == null ) {
                  try {
                      // If we are shutting down, we want to generate the exception quickly.
                      BundleContext bundleContext = getContainerFactoryHolder().getBundleContext();
                      // throws 'IllegalStateException'
  
                      setServiceProperties();
                      service = bundleContext.registerService(FileMonitor.class, this, serviceProperties);
  
                      // See comments on 'loadZipEntries' for why the entries must be loaded now.
                      loadZipEntries();
  
                  } catch ( IllegalStateException e ) {
                      // Ignore; the framework is shutting down.
                  }
              } else {
                  // Do nothing: There is already a service registration.
              }
  
          } else {
              if ( service != null ) {
                  try {
                      service.unregister();
                  } catch ( IllegalStateException e ) {
                      // Ignore; framework is shutting down.
                  }
                  service = null;
              } else {
                  // Do nothing: There is already no service registration.
              }
          }
      }
docs: Update the monitor service according to whether any listeners
  are registered.  That is, if any covering paths are present.
  
  When listeners are registered, register the file monitor as
  a service.  When no listeners are registered, unregister the
  file monitor as a service.
  
  Registration as a service is only done when the notifier is
  an exposed notifier.  For a non-exposed notifier, see
  {@link #updateEnclosingMonitor}.