com.datastax.driver.core.CloseFuture Java Examples
The following examples show how to use
com.datastax.driver.core.CloseFuture.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CassandraManager.java From dropwizard-cassandra with Apache License 2.0 | 5 votes |
@Override public void stop() throws Exception { LOG.debug("Attempting graceful shutdown of Cassandra cluster: {}", cluster.getClusterName()); CloseFuture future = cluster.closeAsync(); try { future.get(shutdownGracePeriod.toMilliseconds(), TimeUnit.MILLISECONDS); } catch (TimeoutException e) { LOG.warn("Cassandra cluster did not close in {}. Forcing it now.", shutdownGracePeriod); future.force(); } }
Example #2
Source File: CassandraSessionImpl.java From newts with Apache License 2.0 | 5 votes |
public Future<Void> shutdown() { final CloseFuture future = m_session.closeAsync(); return new Future<Void>() { @Override public boolean cancel(boolean mayInterruptIfRunning) { return future.cancel(mayInterruptIfRunning); } @Override public boolean isCancelled() { return future.isCancelled(); } @Override public boolean isDone() { return future.isDone(); } @Override public Void get() throws InterruptedException, ExecutionException { return future.get(); } @Override public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return future.get(timeout, unit); } }; }
Example #3
Source File: ReopeningCluster.java From presto with Apache License 2.0 | 4 votes |
@Override public synchronized CloseFuture closeAsync() { throw new UnsupportedOperationException(); }
Example #4
Source File: TestingSession.java From james-project with Apache License 2.0 | 4 votes |
@Override public CloseFuture closeAsync() { return delegate.closeAsync(); }