com.datastax.spark.connector.cql

CassandraConnector

class CassandraConnector extends Serializable with Logging

Provides and manages connections to Cassandra.

A CassandraConnector instance is serializable and can be safely sent over network, because it automatically reestablishes the connection to the same cluster after deserialization. Internally it saves a list of all nodes in the cluster, so a connection can be established even if the host given in the initial config is down.

Multiple CassandraConnectors in the same JVM connected to the same Cassandra cluster will share a single underlying Cluster object. CassandraConnector will close the underlying Cluster object automatically whenever it is not used i.e. no Session or Cluster is open for longer than spark.cassandra.connection.keep_alive_ms property value.

A CassandraConnector object is configured from CassandraConnectorConf object which can be either given explicitly or automatically configured from SparkConf. The connection options are:

Linear Supertypes
Logging, Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CassandraConnector
  2. Logging
  3. Serializable
  4. Serializable
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CassandraConnector(conf: CassandraConnectorConf)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (CassandraConnector, B)

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to ArrowAssoc[CassandraConnector] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def authConf: AuthConf

    Configured authentication options

  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def closeResourceAfterUse[T, C <: AnyRef { def close(): Unit }](closeable: C)(code: (C) ⇒ T): T

    Automatically closes resource after use.

    Automatically closes resource after use. Handy for closing streams, files, sessions etc. Similar to try-with-resources in Java 7.

  12. def closestLiveHost: Host

    Returns the local node, if it is one of the cluster nodes.

    Returns the local node, if it is one of the cluster nodes. Otherwise returns any node.

  13. def connectionFactory: CassandraConnectionFactory

    Connection configurator

  14. def createThriftClient(): CassandraClientProxy

  15. def createThriftClient(host: InetAddress): CassandraClientProxy

    Opens a Thrift client to the given host.

    Opens a Thrift client to the given host. Don't use it unless you really know what you are doing.

  16. def ensuring(cond: (CassandraConnector) ⇒ Boolean, msg: ⇒ Any): CassandraConnector

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to Ensuring[CassandraConnector] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: (CassandraConnector) ⇒ Boolean): CassandraConnector

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to Ensuring[CassandraConnector] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean, msg: ⇒ Any): CassandraConnector

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to Ensuring[CassandraConnector] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. def ensuring(cond: Boolean): CassandraConnector

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to Ensuring[CassandraConnector] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  22. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  24. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  25. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  26. def hosts: Set[InetAddress]

    Known cluster hosts.

    Known cluster hosts. This is going to return all cluster hosts after at least one successful connection has been made

  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. def isTraceEnabled(): Boolean

    Attributes
    protected
    Definition Classes
    Logging
  29. def log: Logger

    Attributes
    protected
    Definition Classes
    Logging
  30. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  31. def logDebug(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  32. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  33. def logError(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  34. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  35. def logInfo(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  36. def logName: String

    Attributes
    protected
    Definition Classes
    Logging
  37. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  38. def logTrace(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  39. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Attributes
    protected
    Definition Classes
    Logging
  40. def logWarning(msg: ⇒ String): Unit

    Attributes
    protected
    Definition Classes
    Logging
  41. def nativePort: Int

    Configured native port

  42. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  43. final def notify(): Unit

    Definition Classes
    AnyRef
  44. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  45. def openSession(): Session

    Returns a shared session to Cassandra and increases the internal open reference counter.

    Returns a shared session to Cassandra and increases the internal open reference counter. It does not release the session automatically, so please remember to close it after use. Closing a shared session decreases the session reference counter. If the reference count drops to zero, the session may be physically closed.

  46. def rpcPort: Int

    Configured thrift client port

  47. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  48. def toString(): String

    Definition Classes
    AnyRef → Any
  49. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. def withCassandraClientDo[T](code: (CassandraClientProxy) ⇒ T): T

  53. def withCassandraClientDo[T](host: InetAddress)(code: (CassandraClientProxy) ⇒ T): T

  54. def withClusterDo[T](code: (Cluster) ⇒ T): T

    Allows to use Cassandra Cluster in a safe way without risk of forgetting to close it.

    Allows to use Cassandra Cluster in a safe way without risk of forgetting to close it. Multiple, concurrent calls might share the same Cluster. The Cluster will be closed when not in use for some time. It is not recommended to obtain sessions from this method. Use withSessionDo instead which allows for proper session sharing.

  55. def withSessionDo[T](code: (Session) ⇒ T): T

    Allows to use Cassandra Session in a safe way without risk of forgetting to close it.

    Allows to use Cassandra Session in a safe way without risk of forgetting to close it. The Session object obtained through this method is a proxy to a shared, single Session associated with the cluster. Internally, the shared underlying Session will be closed shortly after all the proxies are closed.

  56. def [B](y: B): (CassandraConnector, B)

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to ArrowAssoc[CassandraConnector] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (cassandraConnector: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (cassandraConnector: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: CassandraConnector

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to ArrowAssoc[CassandraConnector] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (cassandraConnector: ArrowAssoc[CassandraConnector]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: CassandraConnector

    Implicit information
    This member is added by an implicit conversion from CassandraConnector to Ensuring[CassandraConnector] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (cassandraConnector: Ensuring[CassandraConnector]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from Logging

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from CassandraConnector to StringAdd

Inherited by implicit conversion any2stringfmt from CassandraConnector to StringFormat

Inherited by implicit conversion any2ArrowAssoc from CassandraConnector to ArrowAssoc[CassandraConnector]

Inherited by implicit conversion any2Ensuring from CassandraConnector to Ensuring[CassandraConnector]

Ungrouped