/** * Release connection. * * @param session * the session */ void releaseConnection(Session session) { if (session != null) { session.closeAsync(); } }
@Override public CloseFuture closeAsync() { return session.closeAsync(); }
@Override public CloseFuture call() throws Exception { startSignal.await(); try { return session.closeAsync(); } finally { session = null; } } }
@Override public ListenableFuture<ResultSet> apply(Throwable t) throws Exception { session.closeAsync(); if (t instanceof SyntaxError) { // Give a more explicit message, because it's probably caused by a bad keyspace // name SyntaxError e = (SyntaxError) t; t = new SyntaxError( e.getAddress(), String.format( "Error executing \"%s\" (%s). Check that your keyspace name is valid", useQuery, e.getMessage())); } throw Throwables.propagate(t); } });
/** * {@inheritDoc} */ @Override public CloseFuture closeAsync() { return session.closeAsync(); }
@Override public void onStop(StopEvent event) throws Exception { session.closeAsync(); }
futures.add(controlConnection.closeAsync()); for (Session session : sessions) futures.add(session.closeAsync());
@Override public void onSuccess(Session session) { DefaultCassandraSession.this.session = session; if (oldSession != null) { oldSession.closeAsync(); } callback.handle(Future.succeededFuture()); metrics.afterReconnect(); }
@Override public void onSuccess(Session session) { DefaultCassandraSession.this.session = session; if (oldSession != null) { oldSession.closeAsync(); } callback.handle(Future.succeededFuture()); metrics.afterReconnect(); }
/** * {@inheritDoc} */ @Override public CloseFuture closeAsync() { return getSession().closeAsync(); }
/** * {@inheritDoc} */ @Override public CloseFuture closeAsync() { return getSession().closeAsync(); }
@Override public CloseFuture closeAsync() { return session.closeAsync(); }
@Override public CloseFuture call() throws Exception { startSignal.await(); try { return session.closeAsync(); } finally { session = null; } } }
@Override public ListenableFuture<ResultSet> apply(Throwable t) throws Exception { session.closeAsync(); if (t instanceof SyntaxError) { // Give a more explicit message, because it's probably caused by a bad keyspace name SyntaxError e = (SyntaxError) t; t = new SyntaxError(e.getAddress(), String.format("Error executing \"%s\" (%s). Check that your keyspace name is valid", useQuery, e.getMessage())); } throw Throwables.propagate(t); } });
@Override public CassandraClient disconnect(Handler<AsyncResult<Void>> disconnectHandler) { Context context = vertx.getOrCreateContext(); executeWithSession(session -> { handleOnContext(session.closeAsync(), context, disconnectHandler); }, disconnectHandler); return this; }
@Override public ListenableFuture<ResultSet> create(Throwable t) throws Exception { session.closeAsync(); if (t instanceof SyntaxError) { // Give a more explicit message, because it's probably caused by a bad keyspace name SyntaxError e = (SyntaxError) t; t = new SyntaxError(e.getAddress(), String.format("Error executing \"%s\" (%s). Check that your keyspace name is valid", useQuery, e.getMessage())); } throw Throwables.propagate(t); } });
@Override public ListenableFuture<ResultSet> create(Throwable t) throws Exception { session.closeAsync(); if (t instanceof SyntaxError) { // Give a more explicit message, because it's probably caused by a bad keyspace name SyntaxError e = (SyntaxError) t; t = new SyntaxError(e.getAddress(), String.format("Error executing \"%s\" (%s). Check that your keyspace name is valid", useQuery, e.getMessage())); } throw Throwables.propagate(t); } });
/** * Reconnects to the cluster with a new session. Any existing session is closed asynchronously. */ @Override public void reconnect() { logger.debug("Call to reconnect the session has been made"); Session oldSession = session; session = cluster.connect(); if (oldSession != null) { oldSession.closeAsync(); } metrics.afterReconnect(); }
/** * {@inheritDoc} */ @Override public void reconnect() { logger.debug("Call to reconnect the session has been made"); Session oldSession = session; session = cluster.connect(); if (oldSession != null) { oldSession.closeAsync(); } metrics.afterReconnect(); }
/** * {@inheritDoc} */ @Override public void reconnect() { logger.debug("Call to reconnect the session has been made"); Session oldSession = session; session = cluster.connect(); if (oldSession != null) { oldSession.closeAsync(); } metrics.afterReconnect(); }