本文整理汇总了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;未经允许,请勿转载。 |
请发表评论