/**
  * Un-register the runtime instance
  *
  * @param runtime - runtime instance
  */
 protected void unRegisterRuntime(Runtime runtime) {
   try {
     runtimeManager.unRegisterRuntime(runtime);
   } catch (Exception e) {
     logger.error("Error while removing runtime from Runtime manager", e);
   }
 }
Exemple #2
0
 /**
  * Retrieve the RuntimeManager instance, creating one if necessary.
  *
  * @return RuntimeManager instance.
  */
 public static synchronized RuntimeManager getRuntimeManager() {
   if (rtManager == null) {
     // Perform lookup to find the RuntimeManager instance.
     rtManager = Lookup.getDefault().lookup(RuntimeManager.class);
     // Load the persisted runtimes.
     RuntimeFactory rf = getRuntimeFactory();
     rtManager.loadRuntimes(rf);
     // Make sure the default runtime exists.
     String base = rf.getDefaultBase();
     JavaRuntime rt = rtManager.findByBase(base);
     if (rt == null || !rt.isValid()) {
       // No matching, valid runtime, create a new one.
       String id = rtManager.generateIdentifier();
       rt = rf.createRuntime(base, id);
       rtManager.add(rt);
     }
   }
   return rtManager;
 }
 /**
  * Register the runtime instance
  *
  * @param runtime - runtime instance
  */
 @Reference(
     name = "carbon.runtime.service",
     service = Runtime.class,
     cardinality = ReferenceCardinality.MULTIPLE,
     policy = ReferencePolicy.DYNAMIC,
     unbind = "unRegisterRuntime")
 protected void registerRuntime(Runtime runtime) {
   try {
     runtimeManager.registerRuntime(runtime);
   } catch (Exception e) {
     logger.error("Error while adding runtime to the Runtime manager", e);
   }
 }