Exemple #1
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;
 }