Call response.

@param <T>  the type parameter
@param callable the callable
@param alluxioConf the alluxio conf
@return the response
198368
public static <T> Response call(RestUtils.RestCallable<T> callable,
      AlluxioConfiguration alluxioConf) {
    return call(callable, alluxioConf, null);
  }
743654
public R call(Callable<R> callable) throws ExecutionException, RetryException {
        return this.delegate(callable).call();
    }
1153108
@SuppressWarnings("squid:S2221")
    public <T> T runAsSystem(final Callable<T> callable) {
        return runAsSystemAsTenant(callable, tenantAware.getCurrentTenant());
    }
992444
public static <T> T call(Callable<T> c)
   {
      if (c == null)
      {
         return null;
      }
      try
      {
         return c.call();
      }
      catch (RuntimeException e)
      {
         throw e;
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error invoking Callable [c]", e);
      }
   }
198045
private synchronized void init(AlluxioConfiguration alluxioConf) {
    mJobMasterInquireClient = MasterInquireClient.Factory.createForJobMaster(alluxioConf);
    mJobMasterClientPool =
        new JobMasterClientPool(JobMasterClientContext
            .newBuilder(ClientContext.create(alluxioConf)).build());
  }
1199350
public static <T> Future<T> asyncRun(Callable<T> callable)
	{
		RunnableCallableFuture<T> future = new RunnableCallableFuture<T>(callable);

		future.asyncRun();

		return future;
	}
1294693
public <T> T submit(final Callable<T> callable) {
        if (taskExecutor instanceof ForkJoinPool) {
            try {

                return ((ForkJoinPool) taskExecutor).submit(callable)
                                                    .get();
            } catch (final ExecutionException e) {
                throw ExceptionSoftener.throwSoftenedException(e);

            } catch (final InterruptedException e) {
                Thread.currentThread()
                      .interrupt();
                throw ExceptionSoftener.throwSoftenedException(e);

            }
        }
        try {
            return callable.call();
        } catch (final Exception e) {
            throw new RuntimeException(
                                       e);
        }
    }
840504
public static Response call(String server, String service, DataBinder binder, String... params) {
        return call(server, service, false, binder, params);
    }
391732
public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
        return act(callable,callable.getClass().getClassLoader());
    }
1013052
public static <T> Callable<T> callable(CheckedCallable<T> callable) {
        return Unchecked.callable(callable, Unchecked.RETHROW_ALL);
    }
1039629
<T> T callForJsonType(final String host, final int port, final String path,
      final List<Pair<String, String>> paramList, final Class<T> valueType) throws IOException {
    final String responseString = callForJsonString(host, port, path, paramList);
    if (null == responseString || responseString.length() == 0) {
      return null;
    }
    return new ObjectMapper().readValue(responseString, valueType);
  }
1215535
public ApiResponse<GetConfigResponse> getConfigWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = getConfigValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<GetConfigResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
1069838
public <V> V run(Callable<V> testCallable) throws Exception {
    try {
      beforeRun();
      return testCallable.call();
    } finally {
      afterRun();
      restoreOriginal();
    }
  }
122953
public ApiResponse<Templates> postTemplatesWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = postTemplatesValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<Templates>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
1242878
private static Response createResponse(Object object, AlluxioConfiguration alluxioConf,
      @Nullable Map<String, Object> headers) {
    if (object instanceof Void) {
      return Response.ok().build();
    }
    if (object instanceof String) {
      // Need to explicitly encode the string as JSON because Jackson will not do it automatically.
      ObjectMapper mapper = new ObjectMapper();
      try {
        return Response.ok(mapper.writeValueAsString(object)).build();
      } catch (JsonProcessingException e) {
        return createErrorResponse(e, alluxioConf);
      }
    }

    Response.ResponseBuilder rb = Response.ok(object);
    if (headers != null) {
      headers.forEach(rb::header);
    }

    if (alluxioConf.getBoolean(PropertyKey.WEBUI_CORS_ENABLED)) {
      return makeCORS(rb).build();
    }

    return rb.build();
  }
650631
public SearchResponse searchAll(String index, String type,
            QueryBuilder filterQueryBuilder) {
        return searchAll(index, type, filterQueryBuilder, null);
    }
781312
@Override
    <Result> String execute(final Callable<Result> callable,
                            final TaskCallback<Result> callback,
                            final Object caller) {
        checkArguments(callable, caller);
        return execute(TaskBuilder.create(callable).with(caller).
                callback(callback).on(this).done());
    }