コード例 #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
 BundleContextImpl createBundleContext(boolean checkPermission) {
   if (isFragment()) {
     // fragments cannot have contexts
     return null;
   }
   synchronized (this.monitor) {
     if (context == null) {
       // only create the context if we are starting, active or stopping
       // this is so that SCR can get the context for lazy-start bundles
       if (Module.ACTIVE_SET.contains(module.getState())) {
         context = new BundleContextImpl(this, equinoxContainer);
       }
     }
     return context;
   }
 }
コード例 #3
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);
   }
 }