public interface CassandraProvider
Provides access to a Cassandra cluster through the Cluster
and
Session
objects.
Once initialized, the provider publishes a
CassandraProviderInitializedEvent
in the application context, which
can be used by other beans that need access to the Cassandra cluster in order
to get a reference to the provider when it is ready to be used.
Alternatively, the futures provided by the getClusterFuture()
and
getSessionFuture()
methods can be used. These futures complete once
the respective object becomes available.
Modifier and Type | Method and Description |
---|---|
Cluster |
getCluster()
Returns a reference to the Cassandra cluster.
|
ListenableFuture<Cluster> |
getClusterFuture()
Returns a future reference to the Cassandra cluster.
|
Session |
getSession()
Returns a reference to the Cassandra session.
|
ListenableFuture<Session> |
getSessionFuture()
Returns a future reference to the Cassandra session.
|
boolean |
isInitialized()
Tells whether this provider has been completely initialized.
|
Cluster getCluster()
AuthenticationException
- if the connection to the cluster could not be established
(yet) because there is an authentication problem.IllegalStateException
- if the provider has not been fully initialized yet or has
already been destroyed.NoHostAvailableException
- if the connection to the cluster could not be established
(yet) because none of the configured hosts is available at
the moment.getClusterFuture()
ListenableFuture<Cluster> getClusterFuture()
getCluster()
.getCluster()
boolean isInitialized()
Tells whether this provider has been completely initialized. If
true
, getCluster()
and getSession()
will
return a result and not throw an exception.
Please note that the provider might be destroyed after calling this
method. In this case, getCluster()
and getSession()
might throw, even if this method returned true
previously.
true
if this provider is ready for operation,
false
otherwise.Session getSession()
AuthenticationException
- if the connection to the cluster could not be established
(yet) because there is an authentication problem.IllegalStateException
- if the provider has not been fully initialized yet or has
already been destroyed.InvalidQueryException
- if the provider tried to bind the session to a keyspace, but
the keyspace did not exist (yet).NoHostAvailableException
- if the connection to the cluster could not be established
(yet) because none of the configured hosts is available at
the moment.getSessionFuture()
ListenableFuture<Session> getSessionFuture()
getSession()
.getSession()
Copyright © 2011–2017 aquenos GmbH. All rights reserved.