Package org.apache.hadoop.service

Examples of org.apache.hadoop.service.Service


  /**
   * Return the latest forked process service that ran
   * @return the forkes service
   */
  protected ForkedProcessService latestProcess() {
    Service current = getCurrentService();
    Service prev = getPreviousService();

    Service latest = current != null ? current : prev;
    if (latest instanceof ForkedProcessService) {
      return (ForkedProcessService) latest;
    } else {
      //its a composite object, so look inside it for a process
      if (latest instanceof Parent) {
View Full Code Here


  @Override
  protected void serviceStop() throws Exception {
    //stop current service.
    //this triggers a callback that is caught and ignored
    Service current = currentService;
    previousService = current;
    currentService = null;
    if (current != null) {
      current.stop();
    }
  }
View Full Code Here

    //by setting the current service to null
    //the start-next-service logic is skipped.
    //now, what does that mean w.r.t exit states?

    currentService = null;
    Service head = serviceList.remove(0);

    try {
      head.init(getConfig());
      head.registerServiceListener(this);
      head.start();
    } catch (RuntimeException e) {
      noteFailure(e);
      throw e;
    }
    //at this point the service must have explicitly started & not failed,
View Full Code Here

   * Get the service name via {@link Service#getName()}.
   * If the service is not instantiated, the classname is returned instead.
   * @return the service name
   */
  public String getServiceName() {
    Service s = service;
    String name = null;
    if (s != null) {
      try {
        name = s.getName();
      } catch (Exception ignored) {
        // ignored
      }
    }
    if (name != null) {
View Full Code Here

    }
  }

//  @Override
  public void run() {
    Service service = serviceRef.get();
    if (service == null) {
      return;
    }
    try {
      // Stop the  Service
      service.stop();
    } catch (Throwable t) {
      LOG.info("Error stopping " + service.getName(), t);
    }
  }
View Full Code Here

        ServiceB.class, Service.class);
    final AuxServices aux = new AuxServices();
    aux.init(conf);
    aux.start();

    Service s = aux.getServices().iterator().next();
    s.stop();
    assertEquals("Auxiliary service stopped, but AuxService unaffected.",
        STOPPED, aux.getServiceState());
    assertTrue(aux.getServices().isEmpty());
  }
View Full Code Here

        ServiceB.class, Service.class);
    final AuxServices aux = new AuxServices();
    aux.init(conf);
    aux.start();

    Service s = aux.getServices().iterator().next();
    s.stop();
    assertEquals("Auxiliary service stopped, but AuxService unaffected.",
        STOPPED, aux.getServiceState());
    assertTrue(aux.getServices().isEmpty());
  }
View Full Code Here

    int delay = internalOperations.getGlobalOptions().getOptionInt(
        OptionKeys.INTERNAL_CONTAINER_STARTUP_DELAY,
        OptionKeys.DEFAULT_CONTAINER_STARTUP_DELAY);
    ProviderCompletedCallable completedCallable =
        new ProviderCompletedCallable(execInProgress, null);
    Service notifier = new WorkflowCallbackService<>(
        "accumulo notifier",
        completedCallable,
        delay,
        true);
   
View Full Code Here

  @Override
  protected void serviceStop() throws Exception {
    //stop current service.
    //this triggers a callback that is caught and ignored
    Service current = activeService;
    previousService = current;
    activeService = null;
    if (current != null) {
      current.stop();
    }
  }
View Full Code Here

    //by setting the current service to null
    //the start-next-service logic is skipped.
    //now, what does that mean w.r.t exit states?

    activeService = null;
    Service head = serviceList.remove(0);

    try {
      head.init(getConfig());
      head.registerServiceListener(this);
      head.start();
    } catch (RuntimeException e) {
      noteFailure(e);
      throw e;
    }
    //at this point the service must have explicitly started & not failed,
View Full Code Here

TOP

Related Classes of org.apache.hadoop.service.Service

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.