logger.error(nae.getMessage()); throw nae;
String getRawMessage() { return super.getMessage(); } }
/** * Copy the exception. * * <p>This returns a new exception, equivalent to the original one, except that because a new * object is created in the current thread, the top-most element in the stacktrace of the * exception will refer to the current thread (this is mainly intended for internal use by the * driver). The cause of the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
String getRawMessage() { return super.getMessage(); }
String getRawMessage() { return super.getMessage(); }
String getRawMessage() { return super.getMessage(); }
@Override public void run() { pendingRequestCounter.decrementAndGet(); try { future.getUninterruptibly(); } catch (DriverException e) { cassandraErrorCount.increment(); if (event != null) { if (event.get(JetstreamReservedKeys.MessageAffinityKey .toString()) == null) { event.put(JetstreamReservedKeys.MessageAffinityKey .toString(), (String) event .get(MCConstant.METRIC_NAME)); } getAdviceListener().retry(event, RetryEventCode.MSG_RETRY, e.getMessage()); eventSentToAdviceListener.increment(); } registerError(e); } } }
/** * Build a message {@code String} for the given {@link DriverException}. * <p> * To be called by translator subclasses when creating an instance of a generic * {@link org.springframework.dao.DataAccessException} class. * * @param task readable text describing the task being attempted * @param cql the CQL statement that caused the problem (may be {@literal null}) * @param ex the offending {@code DriverException} * @return the message {@code String} to use */ protected String buildMessage(@Nullable String task, @Nullable String cql, DriverException ex) { if (StringUtils.hasText(task) || StringUtils.hasText(cql)) { return task + "; CQL [" + cql + "]; " + ex.getMessage(); } return ex.getMessage(); } }
/** * This makes it possible to safely drop the annotations_query SASI. * * <p>If dropped, trying to search by annotation in the UI will throw an IllegalStateException. */ private static SelectTraceIdsFromSpan.Factory initialiseSelectTraceIdsFromSpan(Session session) { try { return new SelectTraceIdsFromSpan.Factory(session); } catch (DriverException ex) { LOG.warn("failed to prepare annotation_query index statements: " + ex.getMessage()); return null; } }
/** * Copy the exception. * <p/> * This returns a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this is mainly intended for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
/** * Copy the exception. * <p/> * This returns a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this is mainly intended for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
/** * Copy the exception. * <p/> * This returns a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this is mainly intended for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
/** * Copy the exception. * <p> * This return a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this mainly use for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
/** * {@inheritDoc} */ @Override public void delete(@Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final QualifiedName name) { final String keyspace = name.getDatabaseName(); log.debug("Attempting to drop Cassandra keyspace {} for request {}", keyspace, context); try { this.executeQuery("DROP KEYSPACE IF EXISTS " + keyspace + ";"); log.debug("Successfully dropped {} keyspace", keyspace); } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, name); } }
/** * {@inheritDoc} */ @Override public void delete(@Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final QualifiedName name) { final String keyspace = name.getDatabaseName(); log.debug("Attempting to drop Cassandra keyspace {} for request {}", keyspace, context); try { this.executeQuery("DROP KEYSPACE IF EXISTS " + keyspace + ";"); log.debug("Successfully dropped {} keyspace", keyspace); } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, name); } }
/** * {@inheritDoc} */ @Override public void delete(@Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final QualifiedName name) { final String keyspace = name.getDatabaseName(); final String table = name.getTableName(); log.debug("Attempting to delete Cassandra table {}.{} for request {}", keyspace, table, context); try { this.executeQuery("USE " + keyspace + "; DROP TABLE IF EXISTS " + table + ";"); log.debug("Successfully deleted Cassandra table {}.{} for request {}", keyspace, table, context); } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, name); } }
/** * {@inheritDoc} */ @Override public void delete(@Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final QualifiedName name) { final String keyspace = name.getDatabaseName(); final String table = name.getTableName(); log.debug("Attempting to delete Cassandra table {}.{} for request {}", keyspace, table, context); try { this.executeQuery("USE " + keyspace + "; DROP TABLE IF EXISTS " + table + ";"); log.debug("Successfully deleted Cassandra table {}.{} for request {}", keyspace, table, context); } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, name); } }
/** * {@inheritDoc} */ @Override public boolean exists( @Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final QualifiedName name ) { final String keyspace = name.getDatabaseName(); log.debug("Checking if keyspace {} exists for request {}", keyspace, context); try { final boolean exists = this.getCluster().getMetadata().getKeyspace(keyspace) != null; log.debug("Keyspace {} {} for request {}", keyspace, exists ? "exists" : "doesn't exist", context); return exists; } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, name); } }
/** * {@inheritDoc} */ @Override public boolean exists( @Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final QualifiedName name ) { final String keyspace = name.getDatabaseName(); log.debug("Checking if keyspace {} exists for request {}", keyspace, context); try { final boolean exists = this.getCluster().getMetadata().getKeyspace(keyspace) != null; log.debug("Keyspace {} {} for request {}", keyspace, exists ? "exists" : "doesn't exist", context); return exists; } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, name); } }
/** * {@inheritDoc} */ @Override public void create( @Nonnull @NonNull final ConnectorRequestContext context, @Nonnull @NonNull final DatabaseInfo resource ) { final String keyspace = resource.getName().getDatabaseName(); log.debug("Attempting to create a Cassandra Keyspace named {} for request {}", keyspace, context); try { // TODO: Make this take parameters for replication and the class this.executeQuery( "CREATE KEYSPACE " + keyspace + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};" ); log.debug("Successfully created Cassandra Keyspace named {} for request {}", keyspace, context); } catch (final DriverException de) { log.error(de.getMessage(), de); throw this.getExceptionMapper().toConnectorException(de, resource.getName()); } }