Tabnine Logo
Cluster$Manager.loadBalancingPolicy
Code IndexAdd Tabnine to your IDE (free)

How to use
loadBalancingPolicy
method
in
com.datastax.driver.core.Cluster$Manager

Best Java code snippets using com.datastax.driver.core.Cluster$Manager.loadBalancingPolicy (Showing top 20 results out of 315)

origin: com.datastax.cassandra/cassandra-driver-core

ListenableFuture<Boolean> maybeAddPool(final Host host, Connection reusedConnection) {
 final HostDistance distance = cluster.manager.loadBalancingPolicy().distance(host);
 if (distance == HostDistance.IGNORED) return Futures.immediateFuture(true);
origin: com.datastax.cassandra/cassandra-driver-core

private void onRemove(Host host) throws InterruptedException, ExecutionException {
 if (isClosed()) return;
 boolean locked = host.notificationsLock.tryLock(NOTIF_LOCK_TIMEOUT_SECONDS, TimeUnit.SECONDS);
 if (!locked) {
  logger.warn(
    "Could not acquire notifications lock within {} seconds, ignoring REMOVE notification for {}",
    NOTIF_LOCK_TIMEOUT_SECONDS,
    host);
  return;
 }
 try {
  host.setDown();
  Host.statesLogger.debug("[{}] removing host", host);
  loadBalancingPolicy().onRemove(host);
  controlConnection.onRemove(host);
  for (SessionManager s : sessions) s.onRemove(host);
  for (Host.StateListener listener : listeners) listener.onRemove(host);
 } finally {
  host.notificationsLock.unlock();
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

loadBalancingPolicy().onUp(host);
controlConnection.onUp(host);
origin: com.yugabyte/cassandra-driver-core

void refreshConnectedHost(Host host) {
  // Deal with the control connection if it was using this host
  Host ccHost = controlConnection.connectedHost();
  if (ccHost == null || ccHost.equals(host) && loadBalancingPolicy().distance(ccHost) != HostDistance.LOCAL)
    controlConnection.triggerReconnect();
  for (SessionManager s : sessions)
    s.updateCreatedPools(host);
}
origin: com.yugabyte/cassandra-driver-core

private static void updateLocationInfo(Host host, String datacenter, String rack, boolean isInitialConnection, Cluster.Manager cluster) {
  if (MoreObjects.equal(host.getDatacenter(), datacenter) && MoreObjects.equal(host.getRack(), rack))
    return;
  // If the dc/rack information changes for an existing node, we need to update the load balancing policy.
  // For that, we remove and re-add the node against the policy. Not the most elegant, and assumes
  // that the policy will update correctly, but in practice this should work.
  if (!isInitialConnection)
    cluster.loadBalancingPolicy().onDown(host);
  host.setLocationInfo(datacenter, rack);
  if (!isInitialConnection)
    cluster.loadBalancingPolicy().onAdd(host);
}
origin: com.datastax.dse/dse-java-driver-core

public HostAssert isAtDistance(HostDistance expected) {
 LoadBalancingPolicy loadBalancingPolicy = cluster.manager.loadBalancingPolicy();
 assertThat(loadBalancingPolicy.distance(actual)).isEqualTo(expected);
 return this;
}
origin: io.prestosql.cassandra/cassandra-driver

void refreshConnectedHosts() {
  // Deal first with the control connection: if it's connected to a node that is not LOCAL, try
  // reconnecting (thus letting the loadBalancingPolicy pick a better node)
  Host ccHost = controlConnection.connectedHost();
  if (ccHost == null || loadBalancingPolicy().distance(ccHost) != HostDistance.LOCAL)
    controlConnection.triggerReconnect();
  try {
    for (SessionManager s : sessions)
      Uninterruptibles.getUninterruptibly(s.updateCreatedPools());
  } catch (ExecutionException e) {
    throw DriverThrowables.propagateCause(e);
  }
}
origin: com.stratio.cassandra/cassandra-driver-core

private static void updateLocationInfo(Host host, String datacenter, String rack, Cluster.Manager cluster) {
  if (Objects.equal(host.getDatacenter(), datacenter) && Objects.equal(host.getRack(), rack))
    return;
  // If the dc/rack information changes, we need to update the load balancing policy.
  // For that, we remove and re-add the node against the policy. Not the most elegant, and assumes
  // that the policy will update correctly, but in practice this should work.
  cluster.loadBalancingPolicy().onDown(host);
  host.setLocationInfo(datacenter, rack);
  cluster.loadBalancingPolicy().onAdd(host);
}
origin: io.prestosql.cassandra/cassandra-driver

private static void updateLocationInfo(Host host, String datacenter, String rack, boolean isInitialConnection, Cluster.Manager cluster) {
  if (Objects.equal(host.getDatacenter(), datacenter) && Objects.equal(host.getRack(), rack))
    return;
  // If the dc/rack information changes for an existing node, we need to update the load balancing policy.
  // For that, we remove and re-add the node against the policy. Not the most elegant, and assumes
  // that the policy will update correctly, but in practice this should work.
  if (!isInitialConnection)
    cluster.loadBalancingPolicy().onDown(host);
  host.setLocationInfo(datacenter, rack);
  if (!isInitialConnection)
    cluster.loadBalancingPolicy().onAdd(host);
}
origin: com.datastax.cassandra/cassandra-driver-core

loadBalancingPolicy().init(Cluster.this, contactPointHosts);
for (Host.StateListener listener : listeners) listener.onRegister(Cluster.this);
for (Host host : removedContactPointHosts) {
 loadBalancingPolicy().onRemove(host);
 for (Host.StateListener listener : listeners) listener.onRemove(host);
 loadBalancingPolicy().onDown(host);
 for (Host.StateListener listener : listeners) listener.onDown(host);
 startPeriodicReconnectionAttempt(host, true);
 if (!contactPointHosts.contains(host)) loadBalancingPolicy().onAdd(host);
origin: com.datastax.cassandra/cassandra-driver-core

loadBalancingPolicy().onAdd(host);
if (loadBalancingPolicy().distance(host) == HostDistance.IGNORED) {
origin: com.datastax.cassandra/cassandra-driver-core

loadBalancingPolicy().close();
speculativeExecutionPolicy().close();
configuration.getPolicies().getRetryPolicy().close();
origin: com.datastax.cassandra/cassandra-driver-core

HostDistance distance = loadBalancingPolicy().distance(host);
loadBalancingPolicy().onDown(host);
controlConnection.onDown(host);
for (SessionManager s : sessions) s.onDown(host);
origin: com.datastax.cassandra/cassandra-driver-core

ListenableFuture<Boolean> forceRenewPool(final Host host, Connection reusedConnection) {
 final HostDistance distance = cluster.manager.loadBalancingPolicy().distance(host);
 if (distance == HostDistance.IGNORED) return Futures.immediateFuture(true);
origin: com.datastax.cassandra/cassandra-driver-core

private static void updateLocationInfo(
  Host host,
  String datacenter,
  String rack,
  boolean isInitialConnection,
  Cluster.Manager cluster) {
 if (MoreObjects.equal(host.getDatacenter(), datacenter)
   && MoreObjects.equal(host.getRack(), rack)) return;
 // If the dc/rack information changes for an existing node, we need to update the load balancing
 // policy.
 // For that, we remove and re-add the node against the policy. Not the most elegant, and assumes
 // that the policy will update correctly, but in practice this should work.
 if (!isInitialConnection) cluster.loadBalancingPolicy().onDown(host);
 host.setLocationInfo(datacenter, rack);
 if (!isInitialConnection) cluster.loadBalancingPolicy().onAdd(host);
}
origin: com.datastax.cassandra/cassandra-driver-core

private Iterator<Host> queryPlan() {
 return cluster.loadBalancingPolicy().newQueryPlan(null, Statement.DEFAULT);
}
origin: com.datastax.cassandra/cassandra-driver-core

LoadBalancingPolicy loadBalancingPolicy() {
 return cluster.manager.loadBalancingPolicy();
}
origin: com.datastax.cassandra/cassandra-driver-core

void refreshConnectedHosts() {
 // Deal first with the control connection: if it's connected to a node that is not LOCAL, try
 // reconnecting (thus letting the loadBalancingPolicy pick a better node)
 Host ccHost = controlConnection.connectedHost();
 if (ccHost == null || loadBalancingPolicy().distance(ccHost) != HostDistance.LOCAL)
  controlConnection.triggerReconnect();
 try {
  for (SessionManager s : sessions)
   Uninterruptibles.getUninterruptibly(s.updateCreatedPools());
 } catch (ExecutionException e) {
  throw DriverThrowables.propagateCause(e);
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

public HostAssert isAtDistance(HostDistance expected) {
 LoadBalancingPolicy loadBalancingPolicy = cluster.manager.loadBalancingPolicy();
 assertThat(loadBalancingPolicy.distance(actual)).isEqualTo(expected);
 return this;
}
origin: com.datastax.cassandra/cassandra-driver-core

void refreshConnectedHost(Host host) {
 // Deal with the control connection if it was using this host
 Host ccHost = controlConnection.connectedHost();
 if (ccHost == null
   || ccHost.equals(host) && loadBalancingPolicy().distance(ccHost) != HostDistance.LOCAL)
  controlConnection.triggerReconnect();
 for (SessionManager s : sessions) s.updateCreatedPools(host);
}
com.datastax.driver.coreCluster$ManagerloadBalancingPolicy

Popular methods of Cluster$Manager

  • submitSchemaRefresh
  • triggerOnDown
  • isClosed
  • submitNodeListRefresh
  • <init>
  • addPrepared
  • close
  • ensurePoolsSizing
  • init
  • logUnsupportedVersionProtocol
  • prepareAllQueries
  • protocolVersion
  • prepareAllQueries,
  • protocolVersion,
  • reconnectionPolicy,
  • refreshConnectedHosts,
  • refreshSchemaAndSignal,
  • removeHost,
  • translateAddress,
  • triggerOnAdd,
  • triggerOnRemove

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now