Package org.voltdb.client

Examples of org.voltdb.client.ProcedureCallback


        this.startComputeTime(target.displayName);
        Object params[] = this.generateParams(target);
        this.stopComputeTime(target.displayName);

        ProcedureCallback callback = this.callbacks[target.ordinal()];
        boolean ret = this.getClientHandle().callProcedure(callback, target.callName, params);
        if (debug.val) LOG.debug("Executing txn " + target);
        return (ret);
    }
View Full Code Here


        Client client = this.getClient();
        RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client, true);
       
        final int repeat = 100;
        final StoredProcedureInvocationHints hints = new StoredProcedureInvocationHints();
        final ProcedureCallback callbacks[] = new ProcedureCallback[catalogContext.numberOfPartitions];
        final CountDownLatch latch = new CountDownLatch(catalogContext.numberOfPartitions * repeat);
        for (int p = 0; p < catalogContext.numberOfPartitions; p++) {
            final int partition = p;
            callbacks[p] = new ProcedureCallback() {
                @Override
                public void clientCallback(ClientResponse cresponse) {
                    assertEquals(Status.OK, cresponse.getStatus());
                    assertEquals(partition, cresponse.getBasePartition());
                    latch.countDown();
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(num_txns);
        final AtomicInteger numTotal = new AtomicInteger(0);
        final AtomicInteger numCompleted = new AtomicInteger(0);
        final AtomicInteger numFailed = new AtomicInteger(0);
       
        ProcedureCallback callback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse cr) {
                switch (cr.getStatus()) {
                    case OK:
                        if (cr.getResults()[0].asScalarLong() == VoterConstants.VOTE_SUCCESSFUL) {
View Full Code Here

        // While we're waiting for that to come back, we're going to fire off
        // a bunch of single-partition neworder txns that should all be executed
        // speculatively at the other partition
        final List<ClientResponse> spResponse = new ArrayList<ClientResponse>();
        final AtomicInteger spLatch = new AtomicInteger(0);
        final ProcedureCallback spCallback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse clientResponse) {
                spResponse.add(clientResponse);
                spLatch.decrementAndGet();
            }
View Full Code Here

        RegressionSuiteUtil.initializeTM1Database(this.getCatalogContext(), client);
       
        final int sleepTime = 10000; // ms
        final ClientResponse dtxnResponse[] = new ClientResponse[1];
        final AtomicBoolean latch = new AtomicBoolean(true);
        final ProcedureCallback callback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse clientResponse) {
                // System.err.println("DISTRUBTED RESULT " + clientResponse);
                dtxnResponse[0] = clientResponse;
                latch.set(false);
View Full Code Here

        // We are going to execute them asynchronously to check whether we
        // can share the cache properly
        final int num_invocations = 10;
        final CountDownLatch latch = new CountDownLatch(num_invocations);
        final List<ClientResponse> cresponses = new ArrayList<ClientResponse>();
        ProcedureCallback callback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse clientResponse) {
                cresponses.add(clientResponse);
                latch.countDown();
            }
View Full Code Here

            try {
                response = fds.readObject(ClientResponseImpl.class);
            } catch (IOException e) {
                e.printStackTrace();
            }
            ProcedureCallback cb = null;
            cb = m_callbacks.remove(response.getClientHandle());
            if (cb != null) {
                cb.clientCallback(response);
            }
            else {
                // TODO: what's the right error path here?
                assert(false);
                System.err.println("Invalid response: no callback");
View Full Code Here

        final int interval = this.intervalCounter++;
       
        // HACK: Skip every other interval
        if (interval % 2 != 0) return;
       
        ProcedureCallback callback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse clientResponse) {
                if (clientResponse.getStatus() != Status.OK) {
                    LOG.warn("Failed to get memory stats", clientResponse.getException());
                    return;
View Full Code Here

        final int interval = this.intervalCounter++;
       
        // HACK: Skip every other interval
        if (interval % 2 != 0) return;
       
        ProcedureCallback callback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse clientResponse) {
                if (clientResponse.getStatus() != Status.OK) {
                    LOG.warn("Failed to get table stats", clientResponse.getException());
                    return;
View Full Code Here

        if (this.first.compareAndSet(true, false)) {
            // Fire off a FindOpenSeats so that we can prime ourselves
            Pair<Object[], ProcedureCallback> ret = this.getFindOpenSeatsParams();
            assert(ret != null);
            Object params[] = ret.getFirst();
            ProcedureCallback callback = ret.getSecond();
            this.getClientHandle().callProcedure(callback, Transaction.FIND_OPEN_SEATS.getExecName(), params);
        }
       
        int tries = 10;
        Pair<Object[], ProcedureCallback> ret = null;
        Transaction txn = null;
        while (tries-- > 0 && ret == null) {
            txn = this.xacts.nextValue();
            if (debug.val) LOG.debug("Attempting to execute " + txn);
            this.startComputeTime(txn.displayName);
            try {
                switch (txn) {
                    case DELETE_RESERVATION: {
                        ret = this.getDeleteReservationParams();
                        break;
                    }
                    case FIND_FLIGHTS: {
                        ret = this.getFindFlightsParams();
                        break;
                    }
                    case FIND_OPEN_SEATS: {
                        ret = this.getFindOpenSeatsParams();
                        break;
                    }
                    case NEW_RESERVATION: {
                        ret = this.getNewReservationParams();
                        break;
                    }
                    case UPDATE_CUSTOMER: {
                        ret = this.getUpdateCustomerParams();
                        break;
                    }
                    case UPDATE_RESERVATION: {
                        ret = this.getUpdateReservationParams();
                        break;
                    }
                    default:
                        assert(false) : "Unexpected transaction: " + txn;
                } // SWITCH
            } finally {
                this.stopComputeTime(txn.displayName);
            }
            if (ret != null && debug.val) LOG.debug("Executed a new invocation of " + txn);
        }
        if (ret != null) {
            Object params[] = ret.getFirst();
            ProcedureCallback callback = ret.getSecond();
            this.getClientHandle().callProcedure(callback, txn.getExecName(), params);
        }
       
        if (tries == 0 && debug.val) LOG.warn("I have nothing to do!");
        return (tries > 0);
View Full Code Here

TOP

Related Classes of org.voltdb.client.ProcedureCallback

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.