public boolean isBootstrapping() { if ( getCause() instanceof BadRequestException ) { BadRequestException bre = (BadRequestException)getCause(); String msg = bre.getMessage(); if ( (msg.contains("Keyspace") && msg.contains( "does not exist" )) || msg.contains("unconfigured columnfamily")) { return true; } } return false; }
if ( throwable instanceof CollectionRuntimeException ) { CollectionRuntimeException cre = (CollectionRuntimeException) throwable; isBootstrapping = cre.isBootstrapping(); } else { isBootstrapping = false;
public void call( final Throwable t ) { if ( t instanceof CollectionRuntimeException ) { CollectionRuntimeException cre = ( CollectionRuntimeException ) t; final MvccEntity mvccEntity = cre.getEntity(); final ApplicationScope scope = cre.getApplicationScope(); // one batch to handle rollback MutationBatch rollbackMb = null; final BatchStatement uniqueDeleteBatch = new BatchStatement(); final Optional<Entity> entity = mvccEntity.getEntity(); if ( entity.isPresent() ) { for ( final Field field : entity.get().getFields() ) { // if it's unique, add its deletion to the rollback batch if ( field.isUnique() ) { UniqueValue toDelete = new UniqueValueImpl( field, entity.get().getId(), mvccEntity.getVersion() ); uniqueDeleteBatch.add(uniqueValueStrat.deleteCQL(scope, toDelete )); } } // execute the batch statements for deleting unique field entries session.execute(uniqueDeleteBatch); logEntryStrat.delete( scope, entity.get().getId(), mvccEntity.getVersion() ); } } }
throw new CollectionRuntimeException( null, collectionScope, "An error occurred connecting to cassandra", e );
throw new CollectionRuntimeException( null, applicationScope, "An error occurred connecting to cassandra", e );
throw new CollectionRuntimeException( null, applicationScope, "Failed to execute write asynchronously ", e );
if ( cre.isBootstrapping() ) {
throw new CollectionRuntimeException( null, applicationScope, "An error occurred connecting to cassandra", e );