Examples of ClientResponseImpl


Examples of org.apache.wink.client.internal.handlers.ClientResponseImpl

        cr.setEntity(is);
        return cr;
    }

    private ClientResponse createResponse(final ClientRequest request, final Response response) {
        final ClientResponseImpl cr = new ClientResponseImpl();
        cr.setStatusCode(response.getStatusCode());
        cr.setMessage(response.getStatusText());
        cr.getAttributes().putAll(request.getAttributes());

        // FIXME: Should we use a constant here to avoid creating this dummy runnable every time?
        cr.setContentConsumer(new Runnable()
        {
            public void run() {
                // empty
            }
        });
View Full Code Here

Examples of org.apache.wink.client.internal.handlers.ClientResponseImpl

        cr.setEntity(is);
        return cr;
    }

    private ClientResponse createResponse(final ClientRequest request, final Response response) {
        final ClientResponseImpl cr = new ClientResponseImpl();
        cr.setStatusCode(response.getStatusCode());
        cr.setMessage(response.getStatusText());
        cr.getAttributes().putAll(request.getAttributes());
        processResponseHeaders(cr, response);
        return cr;
    }
View Full Code Here

Examples of org.apache.wink.client.internal.handlers.ClientResponseImpl

        response.setEntity(is);
        return response;
    }

    private ClientResponse createResponse(ClientRequest request, final HttpResponse httpResponse) {
        final ClientResponseImpl response = new ClientResponseImpl();
        StatusLine statusLine = httpResponse.getStatusLine();
        response.setStatusCode(statusLine.getStatusCode());
        response.setMessage(statusLine.getReasonPhrase());
        response.getAttributes().putAll(request.getAttributes());
        response.setContentConsumer(new Runnable() {
           
            public void run() {
              HttpEntity entity = httpResponse.getEntity();
              if (entity != null) {
                  try {
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

        // -------------------------------
        // SHUTDOWN
        // TODO: Execute as a regular sysproc transaction
        // -------------------------------
        if (catalog_proc.getName().equalsIgnoreCase("@Shutdown")) {
            ClientResponseImpl cresponse = new ClientResponseImpl(
                    -1,
                    client_handle,
                    -1,
                    Status.OK,
                    HStoreConstants.EMPTY_RESULT,
                    "");
            this.responseSend(cresponse, clientCallback, EstTime.currentTimeMillis(), 0);

            // Non-blocking....
            Exception error = new Exception("Shutdown command received at " + this.getSiteName());
            this.hstore_coordinator.shutdownCluster(error);
            return (true);
        }
       
        // -------------------------------
        // QUIESCE
        // -------------------------------
//        else if (catalog_proc.getName().equals("@Quiesce")) {
//            // Tell the queue manager ahead of time to wipe out everything!
//            this.txnQueueManager.clearQueues();
//            return (false);
//        }
       
        // -------------------------------
        // EXECUTOR STATUS
        // -------------------------------
        else if (catalog_proc.getName().equalsIgnoreCase("@ExecutorStatus")) {
            if (this.status_monitor != null) {
                this.status_monitor.printStatus();
                RingBufferAppender appender = RingBufferAppender.getRingBufferAppender(LOG);
                if (appender != null) appender.dump(System.err);
            }
            ClientResponseImpl cresponse = new ClientResponseImpl(
                    -1,
                    client_handle,
                    -1,
                    Status.OK,
                    HStoreConstants.EMPTY_RESULT,
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

            LOG.debug(String.format("%s - Rejecting transaction with status %s [clientHandle=%d]",
                      ts, status, ts.getClientHandle()));
       
        String msg = this.REJECTION_MESSAGE; //  + " - [0]";
        ts.setStatus(status);
        ClientResponseImpl cresponse = new ClientResponseImpl();
        cresponse.init(ts, status, HStoreConstants.EMPTY_RESULT, msg);
        this.responseSend(ts, cresponse);

        if (hstore_conf.site.txn_counters) {
            if (status == Status.ABORT_REJECT) {
                TransactionCounter.REJECTED.inc(ts.getProcedure());
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

    public void responseError(long client_handle,
                              Status status,
                              String message,
                              RpcCallback<ClientResponseImpl> clientCallback,
                              long initiateTime) {
        ClientResponseImpl cresponse = new ClientResponseImpl(
                                            -1,
                                            client_handle,
                                            -1,
                                            status,
                                            HStoreConstants.EMPTY_RESULT,
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

                if (debug.val)
                    LOG.error(String.format("Unexpected %s Error for clientHandle #%d: %s",
                              this.asyncCompilerWorkThread.getClass().getSimpleName(),
                              result.clientHandle, result.errorMsg));
               
                ClientResponseImpl errorResponse =
                        new ClientResponseImpl(-1,
                                               result.clientHandle,
                                               this.local_partitions.get(),
                                               Status.ABORT_UNEXPECTED,
                                               HStoreConstants.EMPTY_RESULT,
                                               result.errorMsg);
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

        // At this point all of our HStoreSites came back with an OK on the 2PC PREPARE
        // So that means we can send back the result to the client and then
        // send the 2PC COMMIT message to all of our friends.
        // We want to do this first because the transaction state could get
        // cleaned-up right away when we call HStoreCoordinator.transactionFinish()
        ClientResponseImpl cresponse = this.ts.getClientResponse();
        assert(cresponse.isInitialized()) :
            "Trying to send back ClientResponse for " + ts + " before it was set!";
        this.hstore_site.responseSend(this.ts, cresponse);
    }
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

        if (status == Status.ABORT_RESTART || status == Status.ABORT_SPECULATIVE) {
            hstore_site.getTransactionQueueManager().restartTransaction(this.ts, status);
        }
        // Change the response's status and send back the result to the client
        else {
            ClientResponseImpl cresponse = this.ts.getClientResponse();
            cresponse.setStatus(status);
            if (debug.val)
                LOG.debug(String.format("%s - Sending back %s %s",
                          this.ts, status, cresponse.getClass().getSimpleName()));
            this.hstore_site.responseSend(this.ts, cresponse);
        }
    }
View Full Code Here

Examples of org.voltdb.ClientResponseImpl

       
        try {
            // Get the embedded ClientResponse
            // TODO: We should really just send the raw bytes through the callback instead
            // of having to deserialize it first.
            ClientResponseImpl cresponse = null;
            this.fds.setBuffer(parameter.getOutput().asReadOnlyByteBuffer());
            try {
                cresponse = this.fds.readObject(ClientResponseImpl.class);
            } catch (IOException ex) {
                String msg = String.format("Failed to deserialize %s from %s",
                                           parameter.getClass().getSimpleName(),
                                           HStoreThreadManager.formatSiteName(parameter.getSenderSite()));
                throw new ServerFaultException(msg, ex);
            }
           
            assert(cresponse != null);
            if (debug.val)
                LOG.debug("Returning redirected ClientResponse to client:\n" + cresponse);
            try {
                this.orig_callback.run(cresponse);
            } catch (ClientConnectionLostException ex) {
                if (debug.val) LOG.warn("Lost connection to client for txn #" + cresponse.getTransactionId());
            } catch (Throwable ex) {
                LOG.fatal("Failed to forward ClientResponse data back!", ex);
                throw new RuntimeException(ex);
            }
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.