code: @Override
      @Async
      public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {
          // We need to use the generic OsgiBundleApplicationContextEvent here and test
          // for instanceof since gemini-blueprint does not correctly determine
          // the event type we are listening for.
          if (event instanceof OsgiBundleContextFailedEvent) {
              final Bundle bundle = event.getBundle();
  
              handleStop(bundle);
              stop(bundle);
          }
      }
docs: This method is executed asynchronously since the original extender thread may try to obtain a lock to the OSGi
  framework's registry state during the stop while holding the event handling lock, which may result in a transitive
  deadlock.
  
  @param event can be <code>null</code>, in which case it is ignored.