Search in sources :

Example 1 with EndPoint

use of com.linkedin.cruisecontrol.servlet.EndPoint in project cruise-control by linkedin.

the class AbstractSyncRequest method getResponse.

@Override
public CruiseControlResponse getResponse(HttpServletRequest request, HttpServletResponse response) throws ExecutionException, InterruptedException {
    LOG.info("Processing sync request {}.", name());
    long requestExecutionStartTime = System.nanoTime();
    int step = 0;
    OperationFuture resultFuture = _userTaskManager.getOrCreateUserTask(request, response, uuid -> {
        OperationFuture future = new OperationFuture(String.format("%s request", parameters().endPoint().toString()));
        future.complete(handle());
        return future;
    }, step, false, parameters()).get(step);
    CruiseControlResponse ccResponse = resultFuture.get();
    _successfulRequestExecutionTimer.get(parameters().endPoint()).update(System.nanoTime() - requestExecutionStartTime, TimeUnit.NANOSECONDS);
    return ccResponse;
}
Also used : CruiseControlParameters(com.linkedin.cruisecontrol.servlet.parameters.CruiseControlParameters) Logger(org.slf4j.Logger) EndPoint(com.linkedin.cruisecontrol.servlet.EndPoint) HttpServletResponse(javax.servlet.http.HttpServletResponse) LoggerFactory(org.slf4j.LoggerFactory) AbstractRequest(com.linkedin.kafka.cruisecontrol.servlet.handler.AbstractRequest) CruiseControlResponse(com.linkedin.cruisecontrol.servlet.response.CruiseControlResponse) AbstractAsyncRequest(com.linkedin.kafka.cruisecontrol.servlet.handler.async.AbstractAsyncRequest) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) UserTaskManager(com.linkedin.kafka.cruisecontrol.servlet.UserTaskManager) HttpServletRequest(javax.servlet.http.HttpServletRequest) OperationFuture(com.linkedin.kafka.cruisecontrol.servlet.handler.async.runnable.OperationFuture) Map(java.util.Map) Timer(com.codahale.metrics.Timer) CruiseControlResponse(com.linkedin.cruisecontrol.servlet.response.CruiseControlResponse) OperationFuture(com.linkedin.kafka.cruisecontrol.servlet.handler.async.runnable.OperationFuture) EndPoint(com.linkedin.cruisecontrol.servlet.EndPoint)

Aggregations

Timer (com.codahale.metrics.Timer)1 EndPoint (com.linkedin.cruisecontrol.servlet.EndPoint)1 CruiseControlParameters (com.linkedin.cruisecontrol.servlet.parameters.CruiseControlParameters)1 CruiseControlResponse (com.linkedin.cruisecontrol.servlet.response.CruiseControlResponse)1 UserTaskManager (com.linkedin.kafka.cruisecontrol.servlet.UserTaskManager)1 AbstractRequest (com.linkedin.kafka.cruisecontrol.servlet.handler.AbstractRequest)1 AbstractAsyncRequest (com.linkedin.kafka.cruisecontrol.servlet.handler.async.AbstractAsyncRequest)1 OperationFuture (com.linkedin.kafka.cruisecontrol.servlet.handler.async.runnable.OperationFuture)1 Map (java.util.Map)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeUnit (java.util.concurrent.TimeUnit)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1