コード例 #1
0
 void start() throws InterruptedException {
   if (dependencies.size() > 0) {
     synchronized (this) {
       while (!canStart) {
         this.wait(1000 * 60 * 3L);
         if (dependenciesFailed) {
           throw new TezUncheckedException(
               "Skipping service start for "
                   + service.getName()
                   + " as dependencies failed to start");
         }
       }
     }
   }
   if (LOG.isDebugEnabled()) {
     LOG.debug("Service: " + service.getName() + " trying to start");
   }
   for (Service dependency : dependencies) {
     if (!dependency.isInState(Service.STATE.STARTED)) {
       LOG.info(
           "Service: "
               + service.getName()
               + " not started because "
               + " service: "
               + dependency.getName()
               + " is in state: "
               + dependency.getServiceState());
       return;
     }
   }
   service.start();
 }
コード例 #2
0
 /**
  * Run a child service -initing and starting it if this service has already passed those parts of
  * its own lifecycle
  *
  * @param service the service to start
  */
 protected boolean deployChildService(Service service) {
   service.init(getConfig());
   addService(service);
   if (isInState(STATE.STARTED)) {
     service.start();
     return true;
   }
   return false;
 }