void asyncUpdate() throws BundleException {
   if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
     Debug.printStackTrace(
         new Exception("Framework has been requested to update (restart).")); // $NON-NLS-1$
   }
   lockStateChange(ModuleEvent.UPDATED);
   try {
     if (Module.ACTIVE_SET.contains(getState())) {
       Thread t =
           new Thread(
               new Runnable() {
                 @Override
                 public void run() {
                   try {
                     update();
                   } catch (Throwable e) {
                     SystemBundle.this
                         .getEquinoxContainer()
                         .getLogServices()
                         .log(
                             EquinoxContainer.NAME,
                             FrameworkLogEntry.ERROR,
                             "Error updating the framework.",
                             e); //$NON-NLS-1$
                   }
                 }
               },
               "Framework update"); //$NON-NLS-1$
       t.start();
     }
   } finally {
     unlockStateChange(ModuleEvent.UPDATED);
   }
 }
 @Override
 public void stop(int options) throws BundleException {
   if (options == 0 && equinoxContainer.getConfiguration().getDebug().MONITOR_ACTIVATION) {
     Debug.printStackTrace(
         new Exception("A persistent stop has been called on bundle: " + this)); // $NON-NLS-1$
   }
   module.stop(getStopOptions(options));
 }
 private String findBundleNativeCode(String libname, String mappedName, String[] altMappedNames) {
   String path = null;
   if (debug.DEBUG_LOADER) Debug.println("  mapped library name: " + mappedName); // $NON-NLS-1$
   List<String> nativePaths = getNativePaths();
   if (nativePaths.isEmpty()) {
     return null;
   }
   path = findNativePath(nativePaths, mappedName);
   if (path == null) {
     for (int i = 0; i < altMappedNames.length && path == null; i++)
       path = findNativePath(nativePaths, altMappedNames[i]);
   }
   if (path == null) {
     if (debug.DEBUG_LOADER)
       Debug.println("  library does not exist: " + mappedName); // $NON-NLS-1$
     path = findNativePath(nativePaths, libname);
   }
   if (debug.DEBUG_LOADER) Debug.println("  returning library: " + path); // $NON-NLS-1$
   return path;
 }
 public void init(FrameworkListener... listeners) throws BundleException {
   if (listeners != null) {
     if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
       Debug.println(
           "Initializing framework with framework listeners: " + listeners); // $NON-NLS-1$
     }
     initListeners.addAll(Arrays.asList(listeners));
   } else {
     if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
       Debug.println("Initializing framework with framework no listeners"); // $NON-NLS-1$
     }
   }
   try {
     ((SystemModule) getModule()).init();
   } finally {
     if (!initListeners.isEmpty()) {
       getEquinoxContainer().getEventPublisher().flushFrameworkEvents();
       removeInitListeners();
     }
   }
 }
 void asyncStop() throws BundleException {
   if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
     Debug.printStackTrace(
         new Exception("Framework has been requested to stop.")); // $NON-NLS-1$
   }
   lockStateChange(ModuleEvent.STOPPED);
   try {
     if (Module.ACTIVE_SET.contains(getState())) {
       // TODO this still has a chance of a race condition:
       // multiple threads could get started if stop is called over and over
       Thread t =
           new Thread(
               new Runnable() {
                 @Override
                 public void run() {
                   try {
                     stop();
                   } catch (Throwable e) {
                     SystemBundle.this
                         .getEquinoxContainer()
                         .getLogServices()
                         .log(
                             EquinoxContainer.NAME,
                             FrameworkLogEntry.ERROR,
                             "Error stopping the framework.",
                             e); //$NON-NLS-1$
                   }
                 }
               },
               "Framework stop"); //$NON-NLS-1$
       t.start();
     }
   } finally {
     unlockStateChange(ModuleEvent.STOPPED);
   }
 }