Package org.voltdb

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


            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

    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

                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

        // 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

        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

       
        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

        LocalTransaction ts = new LocalTransaction(hstore_site);
        ts.init(1000l, EstTime.currentTimeMillis(), CLIENT_HANDLE, BASE_PARTITION,
                predict_touchedPartitions, predict_readOnly, predict_canAbort,
                catalog_proc, PARAMS, callback);
       
        ClientResponseImpl cresponse = new ClientResponseImpl(ts.getTransactionId(),
                                                              ts.getClientHandle(),
                                                              ts.getBasePartition(),
                                                              Status.OK,
                                                              HStoreConstants.EMPTY_RESULT,
                                                              "");
        hstore_site.responseSend(ts, cresponse);
       
        // Check to make sure our callback got the ClientResponse
        // And just make sure that they're the same
        assertEquals(callback, ts.getClientCallback());
        ClientResponseImpl clone = callback.getResponse();
        assertNotNull(clone);
        assertEquals(cresponse.getTransactionId(), clone.getTransactionId());
        assertEquals(cresponse.getClientHandle(), clone.getClientHandle());
    }
View Full Code Here

                StoredProcedureInvocation spi = fds.readObject(StoredProcedureInvocation.class);

                VoltTable vt[] = new VoltTable[1];
                vt[0] = new VoltTable(new VoltTable.ColumnInfo("Foo", VoltType.BIGINT));
                vt[0].addRow(1);
                ClientResponseImpl response =
                    new ClientResponseImpl(-1, spi.getClientHandle(), -1, Status.OK, vt, "Extra String");
                c.writeStream().enqueue(response);
                roundTrips.incrementAndGet();
                System.err.println("Sending response.");
            }
            catch (Exception ex) {
View Full Code Here

        // Client gets the final result, and  txn  is about to finish
       
        // STEP 1
        // Send the final result from all the partitions for this MR job
        // back to the client.
        ClientResponseImpl cresponse = new ClientResponseImpl();
        cresponse.init(ts, Status.OK, this.finalResults, "");
        hstore_site.responseSend(ts, cresponse);

        if (hstore_site.getHStoreConf().site.mr_map_blocking) {
            // STEP 2
            // Initialize the FinishCallback and tell every partition in the cluster
View Full Code Here

TOP

Related Classes of org.voltdb.ClientResponseImpl

Copyright © 2018 www.massapicom. 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.