/** * {@inheritDoc} */ public Cassandra.Client getCassandra(String keyspaceNameArg) { getCassandra(); if ( keyspaceNameArg != null && !StringUtils.equals(keyspaceName, keyspaceNameArg)) { if ( log.isDebugEnabled() ) log.debug("keyspace reseting from {} to {}", keyspaceName, keyspaceNameArg); try { cassandraClient.set_keyspace(keyspaceNameArg); } catch (InvalidRequestException ire) { throw new HInvalidRequestException(ire); } catch (TException e) { throw exceptionsTranslator.translate(e); } keyspaceName = keyspaceNameArg; } return cassandraClient; }
public HInvalidRequestException(String msg) { super(msg); setWhy(msg); } public HInvalidRequestException(Throwable t) {
/** * 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; } }
he = new HUnavailableException(original); } else { HInvalidRequestException e = new HInvalidRequestException(original); e.setWhy(why); he = e; he = new HInvalidRequestException(original); } else if (original instanceof org.apache.cassandra.thrift.NotFoundException) { he = new HNotFoundException(original);
if (ire.getMessage().indexOf( "range finish must come after start in the order of traversal") > -1) { return new ArrayList<HColumn<DynamicComposite, ByteBuffer>>();
return new HUnavailableException(original); HInvalidRequestException e = new HInvalidRequestException(original); e.setWhy(why); return e; } else if (original instanceof HPoolExhaustedException ) { return (HInactivePoolException) original; } else if (original instanceof TProtocolException) { return new HInvalidRequestException(original); } else if (original instanceof org.apache.cassandra.thrift.NotFoundException) { return new HNotFoundException(original);
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 ); } }
he = new HUnavailableException(original); } else { HInvalidRequestException e = new HInvalidRequestException(original); e.setWhy(why); he = e; he = new HInvalidRequestException(original); } else if (original instanceof org.apache.cassandra.thrift.NotFoundException) { he = new HNotFoundException(original);
logger.error( e.getMessage(), e ); throw new MetadataRepositoryException( e.getMessage(), e );
public HInvalidRequestException(String msg) { super(msg); setWhy(msg); } public HInvalidRequestException(Throwable t) {
/** * {@inheritDoc} */ public Cassandra.Client getCassandra(String keyspaceNameArg) { getCassandra(); if ( keyspaceNameArg != null && !StringUtils.equals(keyspaceName, keyspaceNameArg)) { if ( log.isDebugEnabled() ) log.debug("keyspace reseting from {} to {}", keyspaceName, keyspaceNameArg); try { cassandraClient.set_keyspace(keyspaceNameArg); } catch (InvalidRequestException ire) { throw new HInvalidRequestException(ire); } catch (TException e) { throw exceptionsTranslator.translate(e); } keyspaceName = keyspaceNameArg; } return cassandraClient; }
logger.error( e.getMessage(), e ); throw new MetadataRepositoryException( e.getMessage(), e );
public HInvalidRequestException(String msg) { super(msg); setWhy(msg); } public HInvalidRequestException(Throwable t) {
/** * {@inheritDoc} */ public Cassandra.Client getCassandra(String keyspaceNameArg) { getCassandra(); if ( keyspaceNameArg != null && !StringUtils.equals(keyspaceName, keyspaceNameArg)) { if ( log.isDebugEnabled() ) log.debug("keyspace reseting from {} to {}", keyspaceName, keyspaceNameArg); try { cassandraClient.set_keyspace(keyspaceNameArg); } catch (InvalidRequestException ire) { throw new HInvalidRequestException(ire); } catch (TException e) { throw new HectorTransportException(e); } keyspaceName = keyspaceNameArg; } return cassandraClient; }