当前位置: 首页>>代码示例>>Java>>正文


Java RequestExecutionException类代码示例

本文整理汇总了Java中org.apache.cassandra.exceptions.RequestExecutionException的典型用法代码示例。如果您正苦于以下问题:Java RequestExecutionException类的具体用法?Java RequestExecutionException怎么用?Java RequestExecutionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RequestExecutionException类属于org.apache.cassandra.exceptions包,在下文中一共展示了RequestExecutionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processBatch

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
public ResultMessage processBatch(BatchStatement statement,
                                  QueryState state,
                                  BatchQueryOptions options,
                                  Map<String, ByteBuffer> customPayload)
                                          throws RequestExecutionException, RequestValidationException
{
    if (customPayload != null)
        requestPayload = customPayload;
    ResultMessage result = QueryProcessor.instance.processBatch(statement, state, options, customPayload);
    if (customPayload != null)
    {
        result.setCustomPayload(responsePayload);
        responsePayload = null;
    }
    return result;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:MessagePayloadTest.java

示例2: processPrepared

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
public ResultMessage processPrepared(CQLStatement statement, QueryState queryState, QueryOptions options)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> variables = options.getValues();
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.getBoundTerms() == 0)))
    {
        if (variables.size() != statement.getBoundTerms())
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.getBoundTerms(),
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    metrics.preparedStatementsExecuted.inc();
    return processStatement(statement, queryState, options);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:QueryProcessor.java

示例3: setupDefaultSuperuser

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
private static void setupDefaultSuperuser()
{
    try
    {
        // insert a default superuser if AUTH_KS.USERS_CF is empty.
        if (!hasExistingUsers())
        {
            QueryProcessor.process(String.format("INSERT INTO %s.%s (name, super) VALUES ('%s', %s) USING TIMESTAMP 0",
                                                 AUTH_KS,
                                                 USERS_CF,
                                                 DEFAULT_SUPERUSER_NAME,
                                                 true),
                                   ConsistencyLevel.ONE);
            logger.info("Created default superuser '{}'", DEFAULT_SUPERUSER_NAME);
        }
    }
    catch (RequestExecutionException e)
    {
        logger.warn("Skipped default superuser setup: some nodes were not ready");
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:Auth.java

示例4: fetchPage

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
public List<Row> fetchPage(int pageSize) throws RequestValidationException, RequestExecutionException
{
    List<Row> result = new ArrayList<Row>();

    int remainingThisQuery = Math.min(remaining, pageSize);
    while (remainingThisQuery > 0 && !isExhausted())
    {
        // isExhausted has set us on the first non-exhausted pager
        List<Row> page = pagers[current].fetchPage(remainingThisQuery);
        if (page.isEmpty())
            continue;

        Row row = page.get(0);
        int fetched = pagers[current].columnCounter().countAll(row.cf).live();
        remaining -= fetched;
        remainingThisQuery -= fetched;
        result.add(row);
    }

    return result;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:MultiPartitionPager.java

示例5: queryNextPage

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestExecutionException
{
    SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
    AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey);
    Composite start = lastReturnedName == null ? sf.start() : lastReturnedName;
    PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
                                                      command.columnFamily,
                                                      command.timestamp,
                                                      keyRange,
                                                      sf,
                                                      start,
                                                      sf.finish(),
                                                      command.rowFilter,
                                                      pageSize,
                                                      command.countCQL3Rows);

    return localQuery
         ? pageCmd.executeLocally()
         : StorageProxy.getRangeSlice(pageCmd, consistencyLevel);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:RangeSliceQueryPager.java

示例6: countPaged

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
/**
 * Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
 */
public static int countPaged(String keyspace,
                             String columnFamily,
                             ByteBuffer key,
                             SliceQueryFilter filter,
                             ConsistencyLevel consistencyLevel,
                             ClientState cState,
                             final int pageSize,
                             long now) throws RequestValidationException, RequestExecutionException
{
    SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
    final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, cState, false);

    ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now);
    while (!pager.isExhausted())
    {
        List<Row> next = pager.fetchPage(pageSize);
        if (!next.isEmpty())
            counter.countAll(next.get(0).cf);
    }
    return counter.live();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:QueryPagers.java

示例7: testScrubColumnValidation

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
@Test
public void testScrubColumnValidation() throws InterruptedException, RequestExecutionException, ExecutionException
{
    QueryProcessor.process(String.format("CREATE TABLE \"%s\".test_compact_static_columns (a bigint, b timeuuid, c boolean static, d text, PRIMARY KEY (a, b))", KEYSPACE), ConsistencyLevel.ONE);

    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("test_compact_static_columns");

    QueryProcessor.executeInternal(String.format("INSERT INTO \"%s\".test_compact_static_columns (a, b, c, d) VALUES (123, c3db07e8-b602-11e3-bc6b-e0b9a54a6d93, true, 'foobar')", KEYSPACE));
    cfs.forceBlockingFlush();
    CompactionManager.instance.performScrub(cfs, false, true, 2);

    QueryProcessor.process("CREATE TABLE \"Keyspace1\".test_scrub_validation (a text primary key, b int)", ConsistencyLevel.ONE);
    ColumnFamilyStore cfs2 = keyspace.getColumnFamilyStore("test_scrub_validation");

    new Mutation(UpdateBuilder.create(cfs2.metadata, "key").newRow().add("b", LongType.instance.decompose(1L)).build()).apply();
    cfs2.forceBlockingFlush();

    CompactionManager.instance.performScrub(cfs2, false, false, 2);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:ScrubTest.java

示例8: execute

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
public ResultMessage execute(ClientState state) throws RequestValidationException, RequestExecutionException
{
    List<PermissionDetails> details = new ArrayList<PermissionDetails>();

    if (resource != null && recursive)
    {
        for (IResource r : Resources.chain(resource))
            details.addAll(list(state, r));
    }
    else
    {
        details.addAll(list(state, resource));
    }

    Collections.sort(details);
    return resultMessage(details);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:ListPermissionsStatement.java

示例9: setupDefaultSuperuser

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
private static void setupDefaultSuperuser()
{
    try
    {
        // insert a default superuser if AUTH_KS.USERS_CF is empty.
        if (QueryProcessor.process(String.format("SELECT * FROM %s.%s", AUTH_KS, USERS_CF), ConsistencyLevel.QUORUM).isEmpty())
        {
            QueryProcessor.process(String.format("INSERT INTO %s.%s (name, super) VALUES ('%s', %s) USING TIMESTAMP 0",
                                                 AUTH_KS,
                                                 USERS_CF,
                                                 DEFAULT_SUPERUSER_NAME,
                                                 true),
                                   ConsistencyLevel.QUORUM);
            logger.info("Created default superuser '{}'", DEFAULT_SUPERUSER_NAME);
        }
    }
    catch (RequestExecutionException e)
    {
        logger.warn("Skipped default superuser setup: some nodes were not ready");
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:Auth.java

示例10: process

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
public ResultMessage process(String query,
                             QueryState state,
                             QueryOptions options,
                             Map<String, ByteBuffer> customPayload)
                                     throws RequestExecutionException, RequestValidationException
{
    if (customPayload != null)
        requestPayload = customPayload;
    ResultMessage result = QueryProcessor.instance.process(query, state, options, customPayload);
    if (customPayload != null)
    {
        result.setCustomPayload(responsePayload);
        responsePayload = null;
    }
    return result;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:MessagePayloadTest.java

示例11: fetchPage

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
public List<Row> fetchPage(int pageSize) throws RequestValidationException, RequestExecutionException
{
    int remaining = pageSize;
    List<Row> result = new ArrayList<Row>();

    while (!isExhausted() && remaining > 0)
    {
        // Exhausted also sets us on the first non-exhausted pager
        List<Row> page = pagers[current].fetchPage(remaining);
        if (page.isEmpty())
            continue;

        Row row = page.get(0);
        remaining -= pagers[current].columnCounter().countAll(row.cf).live();
        result.add(row);
    }

    return result;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:20,代码来源:MultiPartitionPager.java

示例12: queryNextPage

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestExecutionException
{
    SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
    AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey);
    ByteBuffer start = lastReturnedName == null ? sf.start() : lastReturnedName;
    PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
                                                      command.columnFamily,
                                                      command.timestamp,
                                                      keyRange,
                                                      sf,
                                                      start,
                                                      sf.finish(),
                                                      command.rowFilter,
                                                      pageSize);

    return localQuery
         ? pageCmd.executeLocally()
         : StorageProxy.getRangeSlice(pageCmd, consistencyLevel);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:RangeSliceQueryPager.java

示例13: countPaged

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
/**
 * Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
 */
public static int countPaged(String keyspace,
                             String columnFamily,
                             ByteBuffer key,
                             SliceQueryFilter filter,
                             ConsistencyLevel consistencyLevel,
                             final int pageSize,
                             long now) throws RequestValidationException, RequestExecutionException
{
    SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
    final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);

    ColumnCounter counter = filter.columnCounter(Schema.instance.getComparator(keyspace, columnFamily), now);
    while (!pager.isExhausted())
    {
        List<Row> next = pager.fetchPage(pageSize);
        if (!next.isEmpty())
            counter.countAll(next.get(0).cf);
    }
    return counter.live();
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:QueryPagers.java

示例14: mutate

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
private void mutate(List<org.apache.cassandra.db.Mutation> cmds, org.apache.cassandra.db.ConsistencyLevel clvl) throws BackendException {
    try {
        schedule(DatabaseDescriptor.getRpcTimeout());
        try {
            if (atomicBatch) {
                StorageProxy.mutateAtomically(cmds, clvl);
            } else {
                StorageProxy.mutate(cmds, clvl);
            }
        } catch (RequestExecutionException e) {
            throw new TemporaryBackendException(e);
        } finally {
            release();
        }
    } catch (TimeoutException ex) {
        log.debug("Cassandra TimeoutException", ex);
        throw new TemporaryBackendException(ex);
    }
}
 
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:20,代码来源:CassandraEmbeddedStoreManager.java

示例15: mutate

import org.apache.cassandra.exceptions.RequestExecutionException; //导入依赖的package包/类
private void mutate(List<RowMutation> cmds, org.apache.cassandra.db.ConsistencyLevel clvl) throws BackendException {
    try {
        schedule(DatabaseDescriptor.getRpcTimeout());
        try {
            if (atomicBatch) {
                StorageProxy.mutateAtomically(cmds, clvl);
            } else {
                StorageProxy.mutate(cmds, clvl);
            }
        } catch (RequestExecutionException e) {
            throw new TemporaryBackendException(e);
        } finally {
            release();
        }
    } catch (TimeoutException ex) {
        log.debug("Cassandra TimeoutException", ex);
        throw new TemporaryBackendException(ex);
    }
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:20,代码来源:CassandraEmbeddedStoreManager.java


注:本文中的org.apache.cassandra.exceptions.RequestExecutionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。