Package com.datastax.driver.core

Examples of com.datastax.driver.core.ResultSetFuture$ResponseCallback


    protected void handle(QueryGenerator.Request request) {

        final Reporter.Context ctx = reporter.newRequest();

        ResultSetFuture resultSetFuture = request.executeAsync(session);
        Futures.addCallback(resultSetFuture, new FutureCallback<ResultSet>() {
            @Override
            public void onSuccess(final ResultSet result) {
                ctx.done();
                request();
View Full Code Here


    String partitionKey = tm.getPartitionKey().get(0).getName();
   
    Query query = QueryBuilder.select(colName.toString()).from(cfName).where(QueryBuilder.eq(partitionKey, rkey)).limit(1000000)
        .setConsistencyLevel(ConsistencyLevel.valueOf(com.netflix.jmeter.properties.Properties.instance.cassandra.getReadConsistency()));
   
    ResultSetFuture rs = session.executeAsync(query);

    int size = 0;
    try {
      Row row = rs.getUninterruptibly(1000000, TimeUnit.MILLISECONDS).one();
      size = row != null ? row.getBytesUnsafe(colName.toString()).capacity() : 0;
    }
    catch (TimeoutException e) {
      e.printStackTrace();
      throw new OperationException(e);
View Full Code Here

    String clusteredValue = colList[1];
    String colName = colList[2];
   
    Long start = System.nanoTime();
   
    ResultSetFuture rs = session.executeAsync(QueryBuilder.select(colName).from(cfName).where(QueryBuilder.eq(partitionKey, partitionValue))
        .and(QueryBuilder.eq(clusteredKey, clusteredValue)).limit(1000000));
   
    int size = 0;
   
    try {
      Row row = rs.getUninterruptibly(1000000, TimeUnit.MILLISECONDS).one();
      size = row != null ? row.getBytesUnsafe(colName.toString()).capacity() : 0;
    }

    catch (TimeoutException e) {
      e.printStackTrace();
View Full Code Here

        for (int index = 0; index < 15; index++) {
            when(mockDataSource.getData(eq(0), anyInt())).thenReturn(resultList);
            when(mockDataSource.getData(eq(2), anyInt())).thenReturn(new ArrayList<Object[]>());
        }

        ResultSetFuture mockResultSetFuture = mock(ResultSetFuture.class);
        when(mockCassandraSession.executeAsync(any(Query.class))).thenReturn(mockResultSetFuture);

        //create object to test and inject required dependencies
        AggregateDataMigrator objectUnderTest = new AggregateDataMigrator(MigrationTable.ONE_HOUR, mockConfig);
View Full Code Here

        for (int index = 0; index < 15; index++) {
            when(mockDataSource.getData(eq(0), anyInt())).thenReturn(resultList);
            when(mockDataSource.getData(eq(2), anyInt())).thenReturn(new ArrayList<Object[]>());
        }

        ResultSetFuture mockResultSetFuture = mock(ResultSetFuture.class);
        when(mockCassandraSession.executeAsync(any(Query.class))).thenReturn(mockResultSetFuture);

        //create object to test and inject required dependencies
        RawDataMigrator objectUnderTest = new RawDataMigrator(mockConfig);
View Full Code Here

        }
    }

    public StorageResultSetFuture executeAsync(String query) {
        permits.acquire();
        ResultSetFuture future = wrappedSession.executeAsync(query);
        return new StorageResultSetFuture(future, this);
    }
View Full Code Here

        return new StorageResultSetFuture(future, this);
    }

    public StorageResultSetFuture executeAsync(Query query) {
        permits.acquire();
        ResultSetFuture future = wrappedSession.executeAsync(query);
        return new StorageResultSetFuture(future, this);
    }
View Full Code Here

                } else {
                    if (isDataMissing(avg, max, min)) {
                        log.debug("We only have a partial " + bucket + " metric for {scheduleId: " + scheduleId +
                            ", time: " + time.getTime() + "}. It will not be migrated.");
                    } else {
                        ResultSetFuture writeFuture = writeMetrics(time, avg, max, min, ttl, writeTime);
                        Futures.addCallback(writeFuture, this);
                    }

                    time = nextTime;
                    max = row.getDouble(3);
View Full Code Here

        for (Row row : rows) {
            permits.acquire();
            int scheduleId = row.getInt(0);
            BoundStatement statement = updateCacheIndex.bind(ImmutableSet.of(scheduleId), bucket.text(), day,
                CACHE_INDEX_PARTITION, timeSlice, startId(scheduleId), insertTimeSlice);
            ResultSetFuture future = session.executeAsync(statement);
            Futures.addCallback(future, new CacheIndexUpdatedCallback(bucket, scheduleId, timeSlice, updatesFinished),
                tasks);
        }

        updatesFinished.await();
View Full Code Here

        @Override
        public void onSuccess(ResultSet result) {
            permits.acquire();
            BoundStatement statement = deleteIndexEntry.bind(bucket.text(), time, scheduleId);
            ResultSetFuture future = session.executeAsync(statement);
            Futures.addCallback(future, new IndexUpdatedCallback(bucket, scheduleId, updatesFinished), tasks);
        }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.ResultSetFuture$ResponseCallback

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.