コード例 #1
0
 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);
   }
 }
コード例 #2
0
 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);
   }
 }