{@inheritDoc}

@throws IllegalStateException
if the current service state does not permit
this action
516056
@Override
  public synchronized void init(HiveConf hiveConf) {
    ensureCurrentState(STATE.NOTINITED);
    this.hiveConf = hiveConf;
    changeState(STATE.INITED);
    LOG.info("Service:" + getName() + " is inited.");
  }
144396
public T get() throws IllegalStateException {
    switch (this.state) {
      case INCOMPLETE:
        // Do not block browser so just throw ex
        throw new IllegalStateException("The server response did not yet recieved.");
      case FAILED:
        throw new IllegalStateException(this.error);
      case SUCCEEDED:
        return this.value;
      default:
        throw new IllegalStateException("Something very unclear");
    }
  }
1298177
protected HttpServletRequest getCurrentRequest() {
        final HttpServletRequest request = httpService.getCurrentRequest();
        if (request == null) {
            throw new IllegalStateException("No HttpServletRequest bound to current thread");
        }
        return request;
    }
298914
@Override
    public void     start() throws Exception
    {
        if ( !state.compareAndSet(State.LATENT, State.STARTED) )
        {
            throw new IllegalStateException();
        }

        try
        {
            client.create().creatingParentContainersIfNeeded().forPath(queuePath);
        }
        catch ( KeeperException.NodeExistsException ignore )
        {
            // this is OK
        }
        if ( lockPath != null )
        {
            try
            {
                client.create().creatingParentContainersIfNeeded().forPath(lockPath);
            }
            catch ( KeeperException.NodeExistsException ignore )
            {
                // this is OK
            }
        }

        if ( !isProducerOnly || (maxItems != QueueBuilder.NOT_SET) )
        {
            childrenCache.start();
        }

        if ( !isProducerOnly )
        {
            service.submit
                (
                    new Callable<Object>()
                    {
                        @Override
                        public Object call()
                        {
                            runLoop();
                            return null;
                        }
                    }
                );
        }
    }
1243852
private void pushState(boolean isStatic) {
        stateStack.add(new StateStackElement());
        currentScope = new VariableScope(currentScope);
        currentScope.setInStaticContext(isStatic);
    }
79948
public function freeze() {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $name    = $this->name ? ' name="'.$this->name.'"':'';
        $path    = $this->path ? ' path="'.$this->path.'"':'';
        $mapping = $name.$path;

        if (!$this->path)                                           throw new StrutsConfigException('<mapping'.$mapping.': A "path" attribute must be configured for '.$this);
        if (!$this->formClassName && $this->formValidateFirst)      throw new StrutsConfigException('<mapping'.$mapping.': A form must be configured if "form-validate-first" is set to "true".');

        if (!$this->actionClassName && !$this->forward) {
            if (!$this->formClassName || !$this->formValidateFirst) throw new StrutsConfigException('<mapping'.$mapping.': Either an "action", "include", "forward" or "redirect" attribute must be specified.');

            if (!$this->formClassName || !$this->formValidateFirst) {
                throw new StrutsConfigException('<mapping'.$mapping.': Either an "action", "include", "forward" or "redirect" attribute must be specified.');
            }
            elseif ($this->formClassName && $this->formValidateFirst) {
                if (!isset($this->forwards[ActionForward::VALIDATION_SUCCESS_KEY]) || !isset($this->forwards[ActionForward::VALIDATION_ERROR_KEY]))
                    throw new StrutsConfigException('<mapping'.$mapping.' form="'.$this->formClassName.'": A "success" and "error" forward must be configured to validate the form.');
            }
        }

        $this->configured = true;
        return $this;
    }
1188068
public void start() throws IllegalStateException {
        Log.d(TAG, "start");

        if (mediaPlayer != null) {
            currentState = State.STARTED;
            mediaPlayer.setOnCompletionListener(this);
            mediaPlayer.start();
        } else throw new RuntimeException("Media Player is not initialized");
    }
564685
void checkNotClosed() throws JMSException {
        int currentState;
        synchronized (stateLock) {
            currentState = state;
        }
        if (currentState == CLOSED) {
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "SESSION_CLOSED_CWSIA0049",
                                                                               null,
                                                                               tc
                            );
        }
    }
448167
@Override
    protected void service( HttpServletRequest req,
                            HttpServletResponse resp ) throws ServletException, IOException {

        String methodName = req.getMethod();
        ITransaction transaction = null;
        boolean needRollback = false;

        if (LOG.isTraceEnabled()) {
            debugRequest(methodName, req);
        }

        try {
            Principal userPrincipal = req.getUserPrincipal();
            transaction = store.begin(userPrincipal);
            needRollback = true;
            store.checkAuthentication(transaction);
            resp.setStatus(WebdavStatus.SC_OK);

            try {
                IMethodExecutor methodExecutor = methodMap.get(methodName);
                if (methodExecutor == null) {
                    methodExecutor = methodMap.get("*NO*IMPL*");
                }

                methodExecutor.execute(transaction, req, resp);

                store.commit(transaction);
                /**
                 * Clear not consumed data Clear input stream if available otherwise later access include current input. These
                 * cases occure if the client sends a request with body to an not existing resource.
                 */
                if (RequestUtil.streamNotConsumed(req)) {
                    if (LOG.isTraceEnabled()) {
                        LOG.trace("Clear not consumed data!");
                    }
                    try {
                        while (req.getInputStream().available() > 0) {
                            req.getInputStream().read();
                        }
                    } catch (IOException e) {
                        //ignore
                    }
                }
                needRollback = false;
            } catch (IOException e) {
                LOG.error(e, new TextI18n("IOException"));
                resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                store.rollback(transaction);
                throw new ServletException(e);
            }

        } catch (UnauthenticatedException e) {
            resp.sendError(WebdavStatus.SC_FORBIDDEN);
        } catch (AccessDeniedException e) {
            resp.sendError(WebdavStatus.SC_FORBIDDEN);
        } catch (LockFailedException e) {
            resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
        } catch (ObjectAlreadyExistsException e) {
            resp.sendError(WebdavStatus.SC_PRECONDITION_FAILED);
        } catch (ObjectNotFoundException e) {
            resp.sendError(WebdavStatus.SC_NOT_FOUND);
        } catch (WebdavException e) {
            throw new ServletException(e);
        } catch (Throwable t) {
            t = translate(t);
            if (t instanceof UnauthenticatedException) {
                resp.sendError(WebdavStatus.SC_FORBIDDEN);
            } else if (t instanceof AccessDeniedException) {
                resp.sendError(WebdavStatus.SC_FORBIDDEN);
            } else if (t instanceof LockFailedException) {
                resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
            } else if (t instanceof ObjectAlreadyExistsException) {
                resp.sendError(WebdavStatus.SC_PRECONDITION_FAILED);
            } else if (t instanceof ObjectNotFoundException) {
                resp.sendError(WebdavStatus.SC_NOT_FOUND);
            } else if (t instanceof WebdavException) {
                throw new ServletException(t);
            } else {
                throw new ServletException(t);
            }
        } finally {
            if (needRollback) {
                store.rollback(transaction);
            }
        }
    }
1026291
private WaiterState getCurrentState() throws AmazonServiceException {
        try {
            return acceptor.accepts(sdkFunction.apply(request));
        } catch (AmazonServiceException amazonServiceException) {
            return acceptor.accepts(amazonServiceException);
        }

    }
799846
public function hasAllowableAction(Action $action)
    {
        $currentAllowableActions = $this->getAllowableActions();
        if ($currentAllowableActions === null || count($currentAllowableActions->getAllowableActions()) === 0) {
            throw new IllegalStateException('Allowable Actions are not available!');
        }

        return in_array($action, $currentAllowableActions->getAllowableActions(), false);
    }
685556
public synchronized void checkState(State requiredState) throws IllegalStateException {
        if (requiredState != currentState) {
            throw new IllegalStateException(String.format(Locale.US,
                    "Expected state %s, but in state %s", requiredState, currentState));
        }
    }
867457
@Override
    public <T> T action(EntityTypeActionOperation<T> entityTypeActionOperation)
            throws ServiceException {
        try {
            return service.action(entityTypeActionOperation);
        } catch (UniformInterfaceException e) {
            throw processCatch(new ServiceException(e));
        } catch (ClientHandlerException e) {
            throw processCatch(new ServiceException(e));
        }
    }
641633
private boolean stoppingAndNotAllowed(ComponentStatus status, InvocationContext ctx) throws Exception {
      return status.isStopping() && (!ctx.isInTxScope() || !isOngoingTransaction(ctx));
   }
463266
@Override
    public M requestStatus() throws CouldNotPerformException {
        logger.debug("requestStatus of " + this);
        try {
            return getData();
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw ExceptionPrinter.printHistoryAndReturnThrowable(new CouldNotPerformException("Could not request status update.", ex), logger, LogLevel.ERROR);
        }
    }
1355675
public StateMachine<T> next(T nextState) throws IllegalStateException {
        Set<T> allowed = transitions.get(currentState);
        checkNotNull(allowed, "No transitions from state " + currentState);
        checkState(allowed.contains(nextState), "Transition not allowed from state " + currentState + " to " + nextState);
        currentState = nextState;
        return this;
    }
242936
public synchronized void restart() throws IllegalStateException {

        if (this.isShutdown) {
            throw new IllegalStateException("isShutdown==true");
        } else if (this.taskRunnerThread == null) {
            this.taskRunnerThread =
                this.threadFactory.newThread(this.taskRunner);

            this.taskRunnerThread.start();
        } else {
            this.taskQueue.unpark();
        }
    }