@NotThreadSafe public class DseSessionBuilder extends SessionBuilder<DseSessionBuilder,DseSession>
configLoader, keyspace, programmaticContactPoints, requestTracker, self, typeCodecs
Constructor and Description |
---|
DseSessionBuilder() |
Modifier and Type | Method and Description |
---|---|
protected DriverContext |
buildContext(DriverConfigLoader configLoader,
List<TypeCodec<?>> typeCodecs,
NodeStateListener nodeStateListener,
SchemaChangeListener schemaChangeListener,
RequestTracker requestTracker,
Map<String,String> localDatacenters,
Map<String,Predicate<Node>> nodeFilters,
ClassLoader classLoader) |
protected DriverConfigLoader |
defaultConfigLoader() |
DseSessionBuilder |
withApplicationName(String applicationName)
The name of the application using the created session.
|
DseSessionBuilder |
withApplicationVersion(String applicationVersion)
The version of the application using the created session.
|
DseSessionBuilder |
withClientId(UUID clientId)
A unique identifier for the created session.
|
DseSessionBuilder |
withConfigLoader(DriverConfigLoader configLoader)
Sets the configuration loader to use.
|
protected DseSession |
wrap(CqlSession defaultSession) |
addContactEndPoint, addContactEndPoints, addContactPoint, addContactPoints, addTypeCodecs, build, buildAsync, buildDefaultSessionAsync, withClassLoader, withKeyspace, withKeyspace, withLocalDatacenter, withLocalDatacenter, withNodeFilter, withNodeFilter, withNodeStateListener, withRequestTracker, withSchemaChangeListener
@NonNull public DseSessionBuilder withClientId(@Nullable UUID clientId)
It will be sent in the STARTUP
protocol message for each new connection established
by the driver, and may be used by future DSE versions for monitoring purposes.
If you don't call this method, the driver will generate an identifier with Uuids.random()
.
@NonNull public DseSessionBuilder withApplicationName(@Nullable String applicationName)
It will be sent in the STARTUP
protocol message for each new connection established
by the driver, and may be used by future DSE versions for monitoring purposes.
This can also be defined in the driver configuration with the option basic.application.name
; if you specify both, this method takes precedence and the
configuration option will be ignored.
@NonNull public DseSessionBuilder withApplicationVersion(@Nullable String applicationVersion)
It will be sent in the STARTUP
protocol message for each new connection established
by the driver, and may be used by future DSE versions for monitoring purposes.
This can also be defined in the driver configuration with the option basic.application.version
; if you specify both, this method takes precedence and the
configuration option will be ignored.
@NonNull public DseSessionBuilder withConfigLoader(@Nullable DriverConfigLoader configLoader)
Note that this loader must produce a configuration that includes the DSE-specific options:
if you're using one of the built-in implementations provided by the driver, use the static
factory methods from DseDriverConfigLoader
(not the ones from DriverConfigLoader
).
If you don't call this method, the builder will use the default implementation, based on the Typesafe config library. More precisely, configuration properties are loaded and merged from the following (first-listed are higher priority):
application.conf
(all resources on classpath with this name)
application.json
(all resources on classpath with this name)
application.properties
(all resources on classpath with this name)
dse-reference.conf
(all resources on classpath with this name). In particular,
this will load the dse-reference.conf
included in the core DSE driver JAR, that
defines default options for all DSE-specific mandatory options.
reference.conf
(all resources on classpath with this name). In particular, this
will load the reference.conf
included in the core driver JAR, that defines
default options for all mandatory options.
datastax-java-driver
section.
This default loader will honor the reload interval defined by the option basic.config-reload-interval
.
withConfigLoader
in class SessionBuilder<DseSessionBuilder,DseSession>
protected DriverContext buildContext(DriverConfigLoader configLoader, List<TypeCodec<?>> typeCodecs, NodeStateListener nodeStateListener, SchemaChangeListener schemaChangeListener, RequestTracker requestTracker, Map<String,String> localDatacenters, Map<String,Predicate<Node>> nodeFilters, ClassLoader classLoader)
buildContext
in class SessionBuilder<DseSessionBuilder,DseSession>
@NonNull protected DriverConfigLoader defaultConfigLoader()
defaultConfigLoader
in class SessionBuilder<DseSessionBuilder,DseSession>
@NonNull protected DseSession wrap(@NonNull CqlSession defaultSession)
wrap
in class SessionBuilder<DseSessionBuilder,DseSession>
Copyright © 2017–2019. All rights reserved.