throw ServiceStateException.convert(firstException);
throw ServiceStateException.convert(e); } finally {
/** * {@inheritDoc} * @throws ServiceStateException if the current service state does not permit * this action */ @Override public void start() { if (isInState(STATE.STARTED)) { return; } //enter the started state synchronized (stateChangeLock) { if (stateModel.enterState(STATE.STARTED) != STATE.STARTED) { try { startTime = System.currentTimeMillis(); serviceStart(); if (isInState(STATE.STARTED)) { //if the service started (and isn't now in a later state), notify LOG.debug("Service {} is started", getName()); notifyListeners(); } } catch (Exception e) { noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e); } } } }
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);
void stopServices() { // stop in reverse order of start List<Service> serviceList = new ArrayList<Service>(services.size()); for (ServiceWithDependency sd : services.values()) { serviceList.add(sd.service); } Exception firstException = null; for (int i = services.size() - 1; i >= 0; i--) { Service service = serviceList.get(i); if (LOG.isDebugEnabled()) { LOG.debug("Stopping service : " + service); } Exception ex = ServiceOperations.stopQuietly(service); if (ex != null && firstException == null) { LOG.warn("Failed to stop service, name=" + service.getName(), ex); firstException = ex; } } //after stopping all services, rethrow the first exception raised if (firstException != null) { throw ServiceStateException.convert(firstException); } }
throw ServiceStateException.convert(firstError);
throw ServiceStateException.convert(firstException);
throw ServiceStateException.convert(firstException);
throw ServiceStateException.convert(firstException);
throw ServiceStateException.convert(e); } finally {
throw ServiceStateException.convert(e); } finally {
throw ServiceStateException.convert(e); } finally {
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);
throw ServiceStateException.convert(firstException);
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);
throw ServiceStateException.convert(e); } finally {
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);
noteFailure(e); ServiceOperations.stopQuietly(LOG, this); throw ServiceStateException.convert(e);