List of usage examples for org.apache.hadoop.service ServiceStateException ServiceStateException
public ServiceStateException(Throwable cause)
From source file:org.apache.hoya.yarn.service.ForkedProcessService.java
License:Apache License
@Override //AbstractService protected void serviceStart() throws Exception { if (process == null) { throw new ServiceStateException("Subprocess not yet configured"); }/* ww w .ja va 2s .co m*/ //now spawn the process -expect updates via callbacks process.spawnApplication(); }
From source file:org.apache.hoya.yarn.service.SequenceService.java
License:Apache License
/** * Start the next service in the list.//from w w w. j av a2s. co m * Return false if there are no more services to run, or this * service has stopped * @return true if a service was started * @throws RuntimeException from any init or start failure * @throws ServiceStateException if this call is made before * the service is started */ public synchronized boolean startNextService() { if (isInState(STATE.STOPPED)) { //downgrade to a failed log.debug("Not starting next service -{} is stopped", this); return false; } if (!isInState(STATE.STARTED)) { //reject attempts to start a service too early throw new ServiceStateException("Cannot start a child service when not started"); } if (serviceList.isEmpty()) { //nothing left to run return false; } if (currentService != null && currentService.getFailureCause() != null) { //did the last service fail? Is this caused by some premature callback? log.debug("Not starting next service due to a failure of {}", currentService); return false; } //bear in mind that init & start can fail, which //can trigger re-entrant calls into the state change listener. //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, //else an exception would have been raised currentService = head; return true; }
From source file:org.apache.slider.server.services.workflow.ForkedProcessService.java
License:Apache License
@Override //AbstractService protected void serviceStart() throws Exception { if (process == null) { throw new ServiceStateException("Process not yet configured"); }//w w w. j a v a 2s. c o m //now spawn the process -expect updates via callbacks process.start(); }
From source file:org.apache.slider.server.services.workflow.MockService.java
License:Apache License
void finish() { if (fail) {// w w w . ja v a 2s . co m ServiceStateException e = new ServiceStateException(getName() + " failed"); noteFailure(e); stop(); throw e; } else { stop(); } }
From source file:org.apache.slider.server.services.workflow.WorkflowSequenceService.java
License:Apache License
/** * Start the next service in the list./*w w w . ja v a2 s. c o m*/ * Return false if there are no more services to run, or this * service has stopped * @return true if a service was started * @throws RuntimeException from any init or start failure * @throws ServiceStateException if this call is made before * the service is started */ public synchronized boolean startNextService() { if (isInState(STATE.STOPPED)) { //downgrade to a failed LOG.debug("Not starting next service -{} is stopped", this); return false; } if (!isInState(STATE.STARTED)) { //reject attempts to start a service too early throw new ServiceStateException("Cannot start a child service when not started"); } if (serviceList.isEmpty()) { //nothing left to run return false; } if (activeService != null && activeService.getFailureCause() != null) { //did the last service fail? Is this caused by some premature callback? LOG.debug("Not starting next service due to a failure of {}", activeService); return false; } //bear in mind that init & start can fail, which //can trigger re-entrant calls into the state change listener. //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, //else an exception would have been raised activeService = head; return true; }