• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HInvalidRequestException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: swallowOrderedExecution

import me.prettyprint.hector.api.exceptions.HInvalidRequestException; //导入依赖的package包/类
/**
 * This method intentionally swallows ordered execution issues.  For some reason, our Time UUID ordering does
 * not agree with the cassandra comparator as our micros get very close
 * @param query
 * @param <K>
 * @param <UUID>
 * @param <V>
 * @return
 */
protected static <K, UUID, V> List<HColumn<UUID, V>> swallowOrderedExecution( final SliceQuery<K, UUID, V> query ) {
    try {

        return query.execute().get().getColumns();
    }
    catch ( HInvalidRequestException e ) {
        //invalid request.  Occasionally we get order issues when there shouldn't be, disregard them.

        final Throwable invalidRequestException = e.getCause();

        if ( invalidRequestException instanceof InvalidRequestException
                //we had a range error
                && ( ( InvalidRequestException ) invalidRequestException ).getWhy().contains(
                "range finish must come after start in the order of traversal" )) {
            return Collections.emptyList();
        }

        throw e;
    }
}
 
开发者ID:apache,项目名称:usergrid,代码行数:30,代码来源:AbstractSearch.java


示例2: getOrCreateRepository

import me.prettyprint.hector.api.exceptions.HInvalidRequestException; //导入依赖的package包/类
/**
 * if the repository doesn't exist it will be created
 *
 * @param repositoryId
 * @return
 */
public Repository getOrCreateRepository( String repositoryId )
    throws MetadataRepositoryException
{
    String cf = cassandraArchivaManager.getRepositoryFamilyName();

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, StringSerializer.get(), StringSerializer.get(),
                                 StringSerializer.get() ) //
        .setColumnFamily( cf ) //
        .setColumnNames( REPOSITORY_NAME.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId ) //
        .execute();

    if ( result.get().getCount() < 1 )
    {
        // we need to create the repository
        Repository repository = new Repository( repositoryId );

        try
        {
            MutationResult mutationResult = HFactory.createMutator( keyspace, StringSerializer.get() ) //
                .addInsertion( repositoryId, cf,
                               CassandraUtils.column( REPOSITORY_NAME.toString(), repository.getName() ) ) //
                .execute();
            logger.debug( "time to insert repository: {}", mutationResult.getExecutionTimeMicro() );
            return repository;
        }
        catch ( HInvalidRequestException e )
        {
            logger.error( e.getMessage(), e );
            throw new MetadataRepositoryException( e.getMessage(), e );
        }

    }

    return new Repository(
        result.get().getList().get( 0 ).getColumnSlice().getColumnByName( REPOSITORY_NAME.toString() ).getValue() );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:45,代码来源:CassandraMetadataRepository.java


示例3: updateOrAddNamespace

import me.prettyprint.hector.api.exceptions.HInvalidRequestException; //导入依赖的package包/类
private Namespace updateOrAddNamespace( String repositoryId, String namespaceId )
    throws MetadataRepositoryException
{
    try
    {
        Repository repository = getOrCreateRepository( repositoryId );

        String key =
            new Namespace.KeyBuilder().withNamespace( namespaceId ).withRepositoryId( repositoryId ).build();

        Namespace namespace = getNamespace( repositoryId, namespaceId );
        if ( namespace == null )
        {
            String cf = cassandraArchivaManager.getNamespaceFamilyName();
            namespace = new Namespace( namespaceId, repository );
            HFactory.createMutator( keyspace, StringSerializer.get() )
                //  values
                .addInsertion( key, cf, CassandraUtils.column( NAME.toString(), namespace.getName() ) ) //
                .addInsertion( key, cf, CassandraUtils.column( REPOSITORY_NAME.toString(), repository.getName() ) ) //
                .execute();
        }

        return namespace;
    }
    catch ( HInvalidRequestException e )
    {
        logger.error( e.getMessage(), e );
        throw new MetadataRepositoryException( e.getMessage(), e );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:31,代码来源:CassandraMetadataRepository.java


示例4: dropKeyspaceIfExists

import me.prettyprint.hector.api.exceptions.HInvalidRequestException; //导入依赖的package包/类
protected void dropKeyspaceIfExists() {
    try {
        cluster.dropKeyspace(TEST_KEYSPACE, true);
    } catch (HInvalidRequestException ignored) {
        // doesn't exist
    }
}
 
开发者ID:ezoerner,项目名称:c-star-path-j,代码行数:8,代码来源:AbstractCassandraThriftSystemTest.java


示例5: createColumnFamily

import me.prettyprint.hector.api.exceptions.HInvalidRequestException; //导入依赖的package包/类
private void createColumnFamily() {

            ColumnFamilyDefinition columnFamilyDefinition = HFactory.createColumnFamilyDefinition(keyspaceName,
                    columnFamilyName);

            try {
                String columnFamilyId = cluster.addColumnFamily(columnFamilyDefinition, true);
            } catch (HInvalidRequestException e) {
                if (!e.getMessage().contains("Cannot add already existing column family")) {
                    throw new RuntimeException("Error while adding the column family to Cassandra.", e);
                }
            }

        }
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:15,代码来源:CassandraStresser.java


示例6: createCF

import me.prettyprint.hector.api.exceptions.HInvalidRequestException; //导入依赖的package包/类
/**
 * Creates a column family definition.
 * 
 * @param cfName the column family name.
 * @param indexedCols names of columns that will be indexed.
 * @param keyComp the key comparator.
 * @param valueValidationClass the value validation class.
 * @param compositeCol a flag that indicates if columns are composite.
 * @return the column family definition.
 */
protected ColumnFamilyDefinition createCF(
		final String cfName,
		final List<byte[]> indexedCols,
		final ComparatorType keyComp,
		final ComparatorType valueValidationClass,
		final boolean compositeCol) {

	final ColumnFamilyDefinition cfdef = HFactory.createColumnFamilyDefinition(
			_dataAccessLayerFactory.getKeyspaceName(), 
			cfName, 
			compositeCol
				? ComparatorType.COMPOSITETYPE
				: ComparatorType.BYTESTYPE);
	cfdef.setKeyspaceName(_dataAccessLayerFactory.getKeyspaceName());
	cfdef.setColumnType(ColumnType.STANDARD);
	cfdef.setCompactionStrategy("LeveledCompactionStrategy");

	if (compositeCol) {
		cfdef.setComparatorTypeAlias("(BytesType, BytesType, BytesType)");
	}

	for (byte[] col : indexedCols) {
		final String indexColumnFamilyName = "index_" + cfName + "_" + Arrays.hashCode(col);
		try {
			_dataAccessLayerFactory.getCluster().dropColumnFamily(
					_dataAccessLayerFactory.getKeyspaceName(),
					indexColumnFamilyName,
					true);
		} catch (HInvalidRequestException ignore) {
			// Nothing to be done here...
		}
		cfdef.addColumnDefinition(createCDef(col, valueValidationClass.getClassName(), indexColumnFamilyName));
	}

	cfdef.setKeyValidationClass(keyComp.getClassName());
	cfdef.setDefaultValidationClass(valueValidationClass.getClassName());
	cfdef.setCompressionOptions(_compressionOptions);

	return new ThriftCfDef(cfdef);
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:51,代码来源:Cassandra12xTripleIndexDAO.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Block类代码示例发布时间:2022-05-23
下一篇:
Java Event类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap