public class DefaultClient extends Object implements SimpleClient, Closeable, Serializable
Simple class to wrap cassandra Cluster
instance.
Constructor and Description |
---|
DefaultClient(com.datastax.driver.core.Cluster cluster,
String keyspace)
Create a new
DefaultClient instance. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying
Cluster instance. |
com.datastax.driver.core.Session |
connect()
Creates a new session on this cluster.
|
Set<com.datastax.driver.core.Host> |
getAllHosts() |
com.datastax.driver.core.Metadata |
getMetadata() |
boolean |
isClose()
Checks whether the underlying cluster instance is closed.
|
protected boolean |
isDisconnected()
Checks whether the client is already connected to the cluster.
|
public DefaultClient(com.datastax.driver.core.Cluster cluster, String keyspace)
Create a new DefaultClient
instance.
cluster
- a cassandra cluster client.public Set<com.datastax.driver.core.Host> getAllHosts()
public com.datastax.driver.core.Metadata getMetadata()
public com.datastax.driver.core.Session connect() throws com.datastax.driver.core.exceptions.NoHostAvailableException
Creates a new session on this cluster. *
connect
in interface SimpleClient
com.datastax.driver.core.exceptions.NoHostAvailableException
- if we cannot reach any cassandra contact points.protected boolean isDisconnected()
Checks whether the client is already connected to the cluster.
public void close()
Close the underlying Cluster
instance.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface SimpleClient
public boolean isClose()
Checks whether the underlying cluster instance is closed.
isClose
in interface SimpleClient
Copyright © 2022 The Apache Software Foundation. All rights reserved.