public class CassandraProviderBean extends Object implements ApplicationEventPublisherAware, CassandraProvider, DisposableBean, InitializingBean, SmartInitializingSingleton
CassandraProperties
. Initialization of the cluster provided by this
class is first tried in afterPropertiesSet()
. If the initialization
fails, a background thread is created that retries the initialization process
every 30 seconds. The Cluster
and the Session
are closed when
this bean is destroyed (usually when the application context is closed).Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log
Logger for this class.
|
Constructor and Description |
---|
CassandraProviderBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
afterSingletonsInstantiated() |
void |
destroy() |
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.
|
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setCassandraProperties(CassandraProperties cassandraProperties) |
public Cluster getCluster()
CassandraProvider
getCluster
in interface CassandraProvider
CassandraProvider.getClusterFuture()
public ListenableFuture<Cluster> getClusterFuture()
CassandraProvider
getClusterFuture
in interface CassandraProvider
CassandraProvider.getCluster()
.CassandraProvider.getCluster()
public boolean isInitialized()
CassandraProvider
Tells whether this provider has been completely initialized. If
true
, CassandraProvider.getCluster()
and CassandraProvider.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, CassandraProvider.getCluster()
and CassandraProvider.getSession()
might throw, even if this method returned true
previously.
isInitialized
in interface CassandraProvider
true
if this provider is ready for operation,
false
otherwise.public Session getSession()
CassandraProvider
getSession
in interface CassandraProvider
CassandraProvider.getSessionFuture()
public ListenableFuture<Session> getSessionFuture()
CassandraProvider
getSessionFuture
in interface CassandraProvider
CassandraProvider.getSession()
.CassandraProvider.getSession()
@Autowired public void setCassandraProperties(CassandraProperties cassandraProperties)
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher
in interface ApplicationEventPublisherAware
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void afterSingletonsInstantiated()
afterSingletonsInstantiated
in interface SmartInitializingSingleton
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
Copyright © 2011–2017 aquenos GmbH. All rights reserved.