Example #1
0
  protected void startNode()
      throws IMTPException, ProfileException, ServiceException, JADESecurityException,
          NotFoundException {
    // Initialize all services (without activating them)
    List services = new ArrayList();
    initMandatoryServices(services);

    List l = myProfile.getSpecifiers(Profile.SERVICES);
    myProfile.setSpecifiers(Profile.SERVICES, l); // Avoid parsing services twice
    initAdditionalServices(l.iterator(), services);

    // Register with the platform
    ServiceDescriptor[] descriptors = new ServiceDescriptor[services.size()];
    for (int i = 0; i < descriptors.length; ++i) {
      descriptors[i] = (ServiceDescriptor) services.get(i);
    }
    if (theBEManager != null) {
      myNodeDescriptor.setParentNode(theBEManager.getNode());
    }
    // Actually join the platform (this call can modify the name of this container)
    getServiceManager().addNode(myNodeDescriptor, descriptors);
    if (theBEManager != null) {
      theBEManager.register(myNodeDescriptor);
    }

    // Once we are connected, boot all services
    bootAllServices(services);
  }
Example #2
0
  public void shutDown() {
    // Avoid two parallel shut-downs
    synchronized (this) {
      if (terminating) {
        return;
      } else {
        terminating = true;
      }
    }

    // Forward the exit command to the FrontEnd
    try {
      myFrontEnd.exit(false);
    } catch (IMTPException imtpe) {
      // The FrontEnd is disconnected. Force the shutdown of the connection
      myConnectionManager.shutdown();
    }

    // "Kill" all agent images
    killAgentImages();

    if (theBEManager != null) {
      theBEManager.deregister(myNodeDescriptor);
    }
    super.shutDown();
  }
Example #3
0
 private BackEndManager initBEManager() {
   try {
     return BackEndManager.getInstance(null);
   } catch (Exception e) {
     myLogger.log(Logger.WARNING, "Cannot retrieve BackEndManager. " + e);
     e.printStackTrace();
   }
   return null;
 }