Get status of the API.

@throws ExecutionException indicates an error in the HTTP backend
@throws InterruptedException indicates an interruption during the HTTP operation
@throws IOException indicates an error from the API response
187940
public String getStatus() throws ExecutionException, InterruptedException, IOException {
    return (new FutureAPIResponse(client.prepareGet(apiUrl).execute(getHandler()))).get()
        .getMessage();
  }
739490
private int externalInterruptibleAwaitDone() throws InterruptedException {
    int s;
    if (Thread.interrupted())
      throw new InterruptedException();
    if ((s = status) >= 0 && (s = ((this instanceof CountedCompleter)
        ? ForkJoinPool.common.externalHelpComplete((CountedCompleter<?>) this, 0)
        : ForkJoinPool.common.tryExternalUnpush(this) ? doExec() : 0)) >= 0) {
      while ((s = status) >= 0) {
        if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
          synchronized (this) {
            if (status >= 0)
              wait(0L);
            else
              notifyAll();
          }
        }
      }
    }
    return s;
  }
278576
@Override
    public T get() throws InterruptedException {
        while (true) {
            synchronized (this) {
                if (completed) {
                    return results == null || results.isEmpty()
                        ? null
                        : results.get(0);
                }
                wait();
            }
        }
    }
661860
public ExecutionStatus doExecutionLoop() {

		final String methodName = "doExecutionLoop";
		
		// Before we do anything else, see if we're already in STOPPING state.
		if (runtimeExecution.getBatchStatus().equals(BatchStatus.STOPPING)) {
			logger.fine(methodName + " Exiting execution loop as job is now in stopping state.");
			return new ExecutionStatus(ExtendedBatchStatus.JOB_OPERATOR_STOPPING);
		}

		try {
			currentExecutionElement = modelNavigator.getFirstExecutionElement(runtimeExecution.getRestartOnForThisExecution());
		} catch (IllegalTransitionException e) {
			String errorMsg = "Could not transition to first execution element within job.";
			throw new IllegalArgumentException(errorMsg, e);
		}

		if (logger.isLoggable(Level.FINE)) {
			logger.fine("First execution element = " + currentExecutionElement.getId());
		}

		while (true) {

			IExecutionElementController currentElementController = getNextElementController();
			currentStoppableElementController = currentElementController;
			
			// Now that we've re-established a stoppable element controller, check to see if we missed a stop
			if (runtimeExecution.getBatchStatus().equals(BatchStatus.STOPPING)) {
				logger.fine(methodName + " Exiting execution loop as job is now in stopping state.");
				return new ExecutionStatus(ExtendedBatchStatus.JOB_OPERATOR_STOPPING);
			}
			
			// Restarting after a failure up until this point would cause you to restart at the previous restartOn value.  
			// Now we will reset this to 'null'.   Another alternative would be to only 'null' this out when something actually executed.
			// This could have spec implications..maybe let's think of it more.  Or maybe no one cares even.
			ServicesManagerStaticAnchor.getServicesManager().getPersistenceManagerService().updateJobInstanceNullOutRestartOn(runtimeExecution.getTopLevelInstanceId());

			ExecutionStatus status = currentElementController.execute();

			// Nothing special for decision or step except to get exit status.  For flow and split we want to bubble up though.
			if ((currentExecutionElement instanceof Split) || (currentExecutionElement instanceof Flow)) {
				// Exit status and restartOn should both be in the job context.
				if (!status.getExtendedBatchStatus().equals(ExtendedBatchStatus.NORMAL_COMPLETION)) {
					logger.fine("Breaking out of loop with return status = " + status.getExtendedBatchStatus().name());
					return status;
				}
			} 

			// Seems like this should only happen if an Error is thrown at the step level, since normally a step-level
			// exception is caught and the fact that it was thrown capture in the ExecutionStatus
			if (runtimeExecution.getBatchStatus().equals(BatchStatus.FAILED)) {
				String errorMsg = "Sub-execution returned its own BatchStatus of FAILED.  Deal with this by throwing exception to the next layer.";
				throw new BatchContainerRuntimeException(errorMsg);
			}

			// set the execution element controller to null so we don't try to call stop on it after the element has finished executing
			currentStoppableElementController = null;
			
			if (logger.isLoggable(Level.FINE)) {
				logger.fine("Done executing element=" + currentExecutionElement.getId() + ", exitStatus=" + status.getExitStatus());
			}

			if (runtimeExecution.getBatchStatus().equals(BatchStatus.STOPPING)) {
				logger.fine(methodName + " Exiting as job has been stopped");
				return new ExecutionStatus(ExtendedBatchStatus.JOB_OPERATOR_STOPPING);
			}

			Transition nextTransition = null;
			try {
				nextTransition = modelNavigator.getNextTransition(currentExecutionElement, status);
			} catch (IllegalTransitionException e) {
				String errorMsg = "Problem transitioning to next execution element.";
				throw new BatchContainerRuntimeException(errorMsg, e);
			} 

			//
			// We will find ourselves in one of four states now.  
			// 
			// 1. Finished transitioning after a normal execution, but nothing to do 'next'.
			// 2. We just executed a step which through an exception, but didn't match a transition element.
			// 3. We are going to 'next' to another execution element (and jump back to the top of this '
			//    'while'-loop.
			// 4. We matched a terminating transition element (<end>, <stop> or <fail).
			//
			
			// 1.
			if (nextTransition.isFinishedTransitioning()) {
				logger.fine(methodName + " , No next execution element, and no transition element found either.  Looks like we're done and ready for COMPLETED state.");
				this.stepExecIds =  currentElementController.getLastRunStepExecutions();
				// Consider just passing the last 'status' back, but let's unwrap the exit status and pass a new NORMAL_COMPLETION
				// status back instead.
				return new ExecutionStatus(ExtendedBatchStatus.NORMAL_COMPLETION, status.getExitStatus());
			// 2.
			} else if (nextTransition.noTransitionElementMatchedAfterException()) {
				return new ExecutionStatus(ExtendedBatchStatus.EXCEPTION_THROWN, status.getExitStatus());
			// 3.
			} else if (nextTransition.getNextExecutionElement() != null) {
				// hold on to the previous execution element for the decider
				// we need it because we need to inject the context of the
				// previous execution element into the decider
				previousExecutionElement = currentExecutionElement;
				previousElementController = currentElementController;
				currentExecutionElement = nextTransition.getNextExecutionElement();
			// 4.
			} else if (nextTransition.getTransitionElement() != null) {
				ExecutionStatus terminatingStatus = handleTerminatingTransitionElement(nextTransition.getTransitionElement());
				logger.finer(methodName + " , Breaking out of execution loop after processing terminating transition element.");
				return terminatingStatus;
			} else {
				throw new IllegalStateException("Not sure how we'd end up in this state...aborting rather than looping.");
			}
		}
	}
588074
@Override
	public final Void get() throws InterruptedException, ExecutionException {
		block(0);
		if (!isUnblocked()) throw new InterruptedException();
		if (hasError()) throw new ExecutionException(error);
		if (isCancelled()) throw new ExecutionException(cancelled);
		return null;
	}
314896
@Override
    public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
        // when get returns without an exception the synchronisation is complete
        // and else the exception will be thrown
        if (isInitialized()) {
            synchronisationFuture.get(timeout, unit);
        }
        return internalFuture.get(timeout, unit);
    }
600331
public RestClientResponse execute(AsyncHttpClient.BoundRequestBuilder requestBuilder) throws RestClientException {
    Response response;

    try {
      ListenableFuture<Response> futureResponse = requestBuilder.execute();
      response = futureResponse.get();

      if (log.isDebugEnabled()) {
        // the if is here so that we don't call the getResponseBody() when we're not going to print it
        log.debug("Got response body: {}", response.getResponseBody());
      }
    } catch (InterruptedException e) {
      throw new RestClientException("Interrupted while waiting for server response", e);
    } catch (ExecutionException e) {
      throw new RestClientException("Tried to retrieve result from aborted action.", e);
    } catch (IOException e) {
      throw new RestClientException("Encountered IOException while executing REST request.", e);
    }

    return new NingRestClientResponse(response);
  }
728439
def get_status(self):
        
        url = self.base_url + '/status'
        try:
            r = requests.get(url, timeout=10)
            return r.json()
        except RequestException as err:
            raise Client.ClientError(err)
997386
public function getStatuses()
    {
        if (!$this->response) {
            $this->response = $this->prepareRequest()->send();
        }

        if (200 !== $this->response->getStatusCode()) {
            throw new \RuntimeException(sprintf('Client faild with "%s". Status: "%s"', $this->feedUrl , $this->response->getStatusCode()));
        }

        $statuses = $this->extractRawStatuses($this->response->getBody());

        foreach ($statuses as $status) {
            $this->statuses[] = $this->createNewStatusInstance($status);
        }

        return $this->statuses;
    }
362773
public Pair<ExecutionReference, ExecutableFlow> fetchHead()
      throws InterruptedException {
    final Pair<ExecutionReference, ExecutableFlow> pair = this.queuedFlowList.take();
    if (pair != null && pair.getFirst() != null) {
      this.queuedFlowMap.remove(pair.getFirst().getExecId());
    }
    return pair;
  }
1050993
public ApiResponse<GetStatisticDefinitionsResponse> postStatisticDefinitionsWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = postStatisticDefinitionsValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<GetStatisticDefinitionsResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
833021
private HttpResponse executeOnce(RequestSetup setup) throws IOException {
		DefaultRequestDefinition req = new DefaultRequestDefinition();
		setup.setup(req);
		
		HttpResponse response = req.execute();
		
		// This will force the request to complete, causing any timeout exceptions to happen here
		response.getResponseCode();
		
		return response;
	}
814678
public function getStatus(){
        $rest = $this->getService( self::API_CONNECTION);
        $rest->GET();

        return $rest->getResult( models\Connection\Status::class);
    }
839519
public JsonObject sendQuery(FutureAPIResponse response)
      throws ExecutionException, InterruptedException, IOException {
    int status = response.get().getStatus();
    String message = response.get().getMessage();

    if (status != HTTP_OK) {
      throw new IOException(status + " " + message);
    }
    return ((JsonObject) parser.parse(message));
  }
65503
public ApiResponse<String> getPingWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = getPingValidateBeforeCall(null);
        Type localVarReturnType = new TypeToken<String>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }
386388
@Restricted(DoNotUse.class) // WebOnly
    public HttpResponse doRestartStatus() throws IOException {
        JSONObject response = new JSONObject();
        Jenkins jenkins = Jenkins.get();
        response.put("restartRequired", jenkins.getUpdateCenter().isRestartRequiredForCompletion());
        response.put("restartSupported", jenkins.getLifecycle().canRestart());
        return HttpResponses.okJSON(response);
    }
836253
def get_status_from_location(self, response):
        
        self._raise_if_bad_http_status_and_method(response)
        code = response.status_code
        if code == 202:
            self.status = "InProgress"
        else:
            self.status = 'Succeeded'
            if self._is_empty(response):
                self.resource = None
            else:
                self.resource = self._deserialize(response)