<b>Callback</b> (called by RequestCorrelator or Transport).
Adds a response to the response table. When all responses have been received, {@code execute()} returns.
517957
public void receiveResponse(Object response_value, Address sender, boolean is_exception) {
        if(isDone())
            return;
        if(is_exception && response_value instanceof Throwable)
            completeExceptionally((Throwable)response_value);
        else
            complete((T)response_value);
        corrDone();
    }
1151102
public static HttpResponse execute(HttpRequestBase request) throws IOException {

		Assert.notNull(request, "Missing request!");
		HttpClient client = HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()).build();
		return client.execute(request);
	}
660505
protected static <T> T _execute(
                    final URL from_url,
                    final HttpMethod method,
                    final RequestCallback callback,
                    final ResponseExtractor<T> extractor
                    )
    {
        _LOG_.debug( "HTTP: method = " + method + ", URL=" + from_url );

        URI  from_uri = null;
        try {
            from_uri = from_url.toURI();
                                //throws URISyntaxException
        } catch (URISyntaxException ex) {
            throw new HttpException( ex );
        }

        T  response = null;
        try {
            RestTemplate  rest = new RestTemplate();
            response = rest.execute( from_uri, method, callback, extractor );
        } catch (RestClientException ex) {
            _LOG_.error( "HTTP error: " + ex );
            throw new HttpException( ex );
        }

        return response;
    }
63352
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext) {

        return invoke(request, responseHandler, executionContext, null, null);
    }
589266
def execute_callback(self, *args, **kwargs):
        
        response = self._sijax.execute_callback(*args, **kwargs)
        return _make_response(response)
268442
@Override
    public Object invoke(Object conn, Object requestData)
        throws AdapterException, ConnectionException
    {
        try {
            Object result;

            if (jmsSenderReceiver != null) {

                final String responseQueueName = this.getAttributeValueSmart(RESPONSE_QUEUE_NAME);
                final String requestDataForMessage = (String) requestData;
                final Queue replyQueue;
                final String correlationId = getCorrelationId();

                boolean replyIsTemporaryQueue = false;
                if (responseQueueName != null && responseQueueName.length() > 0) {
                    replyQueue = (Queue) ApplicationContext.getNamingProvider().lookup(null,
                            responseQueueName, Queue.class);
                    // msg.setJMSReplyTo(replyQueue);
                }
                else if (this.isSynchronous()) {
                    replyQueue = qSession.createTemporaryQueue();
                    // msg.setJMSReplyTo(replyQueue) ;
                    replyIsTemporaryQueue = true;
                }
                else
                    replyQueue = null;

                jmsSenderReceiver.send(getQueueName(), new MessageCreator() {

                    @Override
                    public Message createMessage(Session session) throws JMSException {
                        Message message = session.createTextMessage(requestDataForMessage);
                        if (correlationId != null)
                            message.setJMSCorrelationID(correlationId);
                        if (replyQueue != null) {
                            message.setJMSReplyTo(replyQueue);
                        }
                        return message;
                    }

                });
                if (this.isSynchronous()) {
                    Message message = null;
                    jmsSenderReceiver.setReceiveTimeout(getTimeoutForResponse() * 1000);
                    if (replyIsTemporaryQueue) {
                        message = jmsSenderReceiver.receive(replyQueue);
                    }
                    else {
                        String messageSelector = "JMSCorrelationID = '" + correlationId + "'";
                        message = jmsSenderReceiver.receiveSelected(replyQueue, messageSelector);
                    }
                    if (message == null) {
                        throw new ActivityException(
                                "Synchronous JMS call times out while waiting for response");
                    }
                    else {
                        result = ((TextMessage)message).getText();
                    }
                }
                else
                    result = null;
            }
            else {
                QueueSession qSession = (QueueSession)conn;
                Queue replyQueue;
                boolean replyIsTemporaryQueue = false;
                QueueSender qSender = qSession.createSender(queue);
                TextMessage msg = qSession.createTextMessage((String)requestData);
                String responseQueueName = this.getAttributeValueSmart(RESPONSE_QUEUE_NAME);
                if (responseQueueName!=null && responseQueueName.length()>0) {
                    replyQueue = (Queue)ApplicationContext.getNamingProvider().lookup(null,responseQueueName,Queue.class);
                    msg.setJMSReplyTo(replyQueue);
                } else if (this.isSynchronous()) {
                    replyQueue = qSession.createTemporaryQueue();
                    msg.setJMSReplyTo(replyQueue);
                    replyIsTemporaryQueue = true;
                } else replyQueue = null;
                String correlationId = getCorrelationId();
                if (correlationId!=null) msg.setJMSCorrelationID(correlationId);
                qSender.send(msg);
                if (this.isSynchronous()) {
                    MessageConsumer consumer;
                    if (replyIsTemporaryQueue) {
                        consumer = qSession.createConsumer(replyQueue);
                    } else {
                        String messageSelector = "JMSCorrelationID = '" + correlationId + "'";
                        consumer = qSession.createConsumer(replyQueue, messageSelector);
                    }
                    msg = (TextMessage)consumer.receive(getTimeoutForResponse()*1000);
                    if (msg==null) {
                        throw new ActivityException("Synchronous JMS call times out while waiting for response");
                    } else {
                        result = msg.getText();
                    }
                } else result = null;
            }
            return result;
        } catch (Exception e) {
//            logger.severeException("Exception in JmsAdapter.invoke()" , e);
            throw new AdapterException(-1, "Exception in invoking JmsAdapter" , e);
        }
    }
967371
@Beta
  public Future<HttpResponse> executeAsync() {
    return executeAsync(
        Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setDaemon(true).build()));
  }
1049186
private <Output, Input> Response<Output> doInvoke(Request<Input> request,
                                                      RequestConfig requestConfig,
                                                      ExecutionContext executionContext,
                                                      HttpResponseHandler<Output> responseHandler,
                                                      HttpResponseHandler<? extends SdkBaseException> errorResponseHandler) {
        request.setEndpoint(endpoint);
        return client.requestExecutionBuilder()
                .request(request)
                .requestConfig(requestConfig)
                .executionContext(executionContext)
                .errorResponseHandler(errorResponseHandler)
                .execute(responseHandler);
    }
773121
@Override
	public Response process(Response.ResponseBuilder responseBuilder)
	{
		final String entity = process();

		responseBuilder.entity(entity);

		return responseBuilder.build();
	}
389348
public Response executeToResponse(HttpConnection connection) {
        InputStream is = null;
        try {
            is = this.executeToInputStream(connection);
            Response response = getResponse(is, Response.class, getGson());
            response.setStatusCode(connection.getConnection().getResponseCode());
            response.setReason(connection.getConnection().getResponseMessage());
            return response;
        } catch (IOException e) {
            throw new CouchDbException("Error retrieving response code or message.", e);
        } finally {
            close(is);
        }
    }
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);
  }
408566
public synchronized QueryResult execute() throws QueryException, InterruptedException {
        // create query string
        String queryString = query.getText();
        System.out.println("queryString = " + queryString);

        // count statement
        String countQueryString = "SELECT COUNT(*) FROM (" + queryString + ")";


        // set query's input wrapper
        synchronized (inputWrapper) {
            try {
                inputWrapper.statement = conn.createStatement();
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                return null;
            }
            inputWrapper.query = queryString;
            try {
                inputWrapper.countStatement = conn.createStatement();
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                return null;
            }
            inputWrapper.countQuery = countQueryString;
            inputWrapper.pending = true;
            inputWrapper.notify();
        }

        synchronized (resultWrapper) {
            try {
                // wait for the query to complete
                while (!resultWrapper.serviced) {
                    resultWrapper.wait();
                }
                if (resultWrapper.exception != null) {
                    throw resultWrapper.exception;
                }
            } catch (InterruptedException e) {
                cancel();
                throw e;
            } finally {
                resultWrapper.serviced = false;
            }

            return new QueryResult(resultWrapper.resultSet, resultWrapper.count, resultWrapper.executeTime);
        }
    }
486805
public CompletableFuture<ExecuteResponse> execute(ExecuteRequest request) {
    logRequest(request);
    return CompletableFuture.completedFuture(logResponse(ExecuteResponse.error()));
  }
315993
private CompletableFuture<ExecuteResponse> execute(ExecuteRequest request) {
    return getService(request).thenCompose(service -> service.execute(request));
  }
926898
protected <T> T _execute(
                    final String string_url,
                    final HttpMethod method,
                    final RequestCallback callback,
                    final ResponseExtractor<T> extractor
                    )
    {
        _LOG_.debug( "HTTP: method = " + method + ", URL=" + string_url );

        URI  uri = null;
        try {
            URL  url = new URL( string_url );   //throws MalformedURLException
            uri = url.toURI();                  //throws URISyntaxException
        } catch (Exception ex) {
            _LOG_.error( "HTTP client error: " + ex );
            throw new HttpException( ex );
        }

        T  response = null;
        try {
            RestTemplate  rest = new RestTemplate();
            response = rest.execute( uri, method, callback, extractor );
                            //throws RestClientException
        } catch (Exception ex) {
            _LOG_.error( "HTTP client error: " + ex );
            throw new HttpException( ex );
        }

        return response;
    }
197943
@Override
    public int executeBatch()
    {
        Map<String, List<Row>> batchData = new HashMap<String, List<Row>>();
        try
        {
            for (Node node : nodes)
            {
                if (node.isDirty())
                {
                    Row action = null;
                    node.handlePreEvent();
                    Object rowKey = node.getEntityId();
                    Object entity = node.getData();
                    EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, node.getDataClass());
                    String tableName = HBaseUtils.getHTableName(m.getSchema(), m.getTableName());
                    if (node.isInState(RemovedState.class))
                    {
                        action = handler.prepareDelete(rowKey);
                    }
                    else
                    {
                        HBaseRow hbaseRow = ((HBaseDataHandler) handler).createHbaseRow(m, entity, rowKey, null);
                        action = handler.preparePut(hbaseRow);
                    }
                    node.handlePostEvent();
                    if (!batchData.containsKey(tableName))
                    {
                        batchData.put(tableName, new ArrayList<Row>());
                    }
                    batchData.get(tableName).add(action);
                }
            }

            if (!batchData.isEmpty())
            {
                ((HBaseDataHandler) handler).batchProcess(batchData);
            }
            return batchData.size();
        }
        catch (IOException ioex)
        {
            log.error("Error while executing batch insert/update, Caused by: .", ioex);
            throw new KunderaException(ioex);
        }

    }
624205
public void putResponse(Response<?> r) {
        synchronized (responseMap) {
            List<Response<?>> l = responseMap.get(r.getCorrelationId());
            if (l == null) {
                l = new SortedResponseList();
                responseMap.put(r.getCorrelationId(), l);
            }
            l.add(r);
        }
    }