com.datastax.driver.core.Cluster.checkNotClosed()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中com.datastax.driver.core.Cluster.checkNotClosed()方法的一些代码示例,展示了Cluster.checkNotClosed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cluster.checkNotClosed()方法的具体详情如下:
包路径:com.datastax.driver.core.Cluster
类名称:Cluster
方法名:checkNotClosed

Cluster.checkNotClosed介绍

暂无

代码示例

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * The cluster metrics.
 *
 * @return the cluster metrics, or {@code null} if this cluster has not yet been {@link #init()
 *     initialized}, or if metrics collection has been disabled (that is if {@link
 *     Configuration#getMetricsOptions} returns {@code null}).
 */
public Metrics getMetrics() {
 checkNotClosed(manager);
 return manager.metrics;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Creates a new session on this cluster but does not initialize it.
 *
 * <p>Because this method does not perform any initialization, it cannot fail. The initialization
 * of the session (the connection of the Session to the Cassandra nodes) will occur if either the
 * {@link Session#init} method is called explicitly, or whenever the returned session object is
 * used.
 *
 * <p>Once a session returned by this method gets initialized (see above), it will be set to no
 * keyspace. If you want to set such session to a keyspace, you will have to explicitly execute a
 * 'USE mykeyspace' query.
 *
 * <p>Note that if you do not particularly need to defer initialization, it is simpler to use one
 * of the {@code connect()} method of this class.
 *
 * @return a new, non-initialized session on this cluster.
 */
public Session newSession() {
 checkNotClosed(manager);
 return manager.newSession();
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Unregisters the provided latency tracking from being updated with host read latencies.
 *
 * <p>This method is a no-op if {@code tracker} hasn't previously been registered against this
 * Cluster.
 *
 * @param tracker the {@link LatencyTracker} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(LatencyTracker tracker) {
 checkNotClosed(manager);
 boolean removed = manager.latencyTrackers.remove(tracker);
 if (removed) tracker.onUnregister(this);
 return this;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Unregisters the provided schema change listener from being updated with schema change events.
 *
 * <p>This method is a no-op if {@code listener} hasn't previously been registered against this
 * Cluster.
 *
 * @param listener the {@link SchemaChangeListener} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(SchemaChangeListener listener) {
 checkNotClosed(manager);
 boolean removed = manager.schemaChangeListeners.remove(listener);
 if (removed) listener.onUnregister(this);
 return this;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Unregisters the provided listener from being notified on hosts events.
 *
 * <p>This method is a no-op if {@code listener} hasn't previously been registered against this
 * Cluster.
 *
 * @param listener the {@link Host.StateListener} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(Host.StateListener listener) {
 checkNotClosed(manager);
 boolean removed = manager.listeners.remove(listener);
 if (removed) listener.onUnregister(this);
 return this;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Registers the provided listener to be updated with schema change events.
 *
 * <p>Registering the same listener multiple times is a no-op.
 *
 * @param listener the new {@link SchemaChangeListener} to register.
 * @return this {@code Cluster} object;
 */
public Cluster register(SchemaChangeListener listener) {
 checkNotClosed(manager);
 boolean added = manager.schemaChangeListeners.add(listener);
 if (added) listener.onRegister(this);
 return this;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Registers the provided listener to be notified on hosts up/down/added/removed events.
 *
 * <p>Registering the same listener multiple times is a no-op.
 *
 * <p>This method should be used to register additional listeners on an already-initialized
 * cluster. To add listeners to a cluster object prior to its initialization, use {@link
 * Builder#withInitialListeners(Collection)}. Calling this method on a non-initialized cluster
 * will result in the listener being {@link
 * com.datastax.driver.core.Host.StateListener#onRegister(Cluster) notified} twice of cluster
 * registration: once inside this method, and once at cluster initialization.
 *
 * @param listener the new {@link Host.StateListener} to register.
 * @return this {@code Cluster} object;
 */
public Cluster register(Host.StateListener listener) {
 checkNotClosed(manager);
 boolean added = manager.listeners.add(listener);
 if (added) listener.onRegister(this);
 return this;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * Registers the provided tracker to be updated with hosts read latencies.
 *
 * <p>Registering the same tracker multiple times is a no-op.
 *
 * <p>Beware that the registered tracker's {@link LatencyTracker#update(Host, Statement,
 * Exception, long) update} method will be called very frequently (at the end of every query to a
 * Cassandra host) and should thus not be costly.
 *
 * <p>The main use case for a {@link LatencyTracker} is to allow load balancing policies to
 * implement latency awareness. For example, {@link LatencyAwarePolicy} registers it's own
 * internal {@code LatencyTracker} (automatically, you don't have to call this method directly).
 *
 * @param tracker the new {@link LatencyTracker} to register.
 * @return this {@code Cluster} object;
 */
public Cluster register(LatencyTracker tracker) {
 checkNotClosed(manager);
 boolean added = manager.latencyTrackers.add(tracker);
 if (added) tracker.onRegister(this);
 return this;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

/**
 * The cluster metrics.
 *
 * @return the cluster metrics, or {@code null} if this cluster has not yet been {@link #init() initialized}, or if
 * metrics collection has been disabled (that is if {@link Configuration#getMetricsOptions} returns {@code null}).
 */
public Metrics getMetrics() {
  checkNotClosed(manager);
  return manager.metrics;
}

代码示例来源:origin: com.yugabyte/cassandra-driver-core

/**
 * The cluster metrics.
 *
 * @return the cluster metrics, or {@code null} if this cluster has not yet been {@link #init() initialized}, or if
 * metrics collection has been disabled (that is if {@link Configuration#getMetricsOptions} returns {@code null}).
 */
public Metrics getMetrics() {
  checkNotClosed(manager);
  return manager.metrics;
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * The cluster metrics.
 *
 * @return the cluster metrics, or {@code null} if this cluster has not yet been {@link #init() initialized}, or if
 * metrics collection has been disabled (that is if {@link Configuration#getMetricsOptions} returns {@code null}).
 */
public Metrics getMetrics() {
  checkNotClosed(manager);
  return manager.metrics;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

checkNotClosed(manager);
init();
final Session session = manager.newSession();

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * Registers the provided listener to be updated with schema change events.
 * <p/>
 * Registering the same listener multiple times is a no-op.
 *
 * @param listener the new {@link SchemaChangeListener} to register.
 * @return this {@code Cluster} object;
 */
public Cluster register(SchemaChangeListener listener) {
  checkNotClosed(manager);
  boolean added = manager.schemaChangeListeners.add(listener);
  if (added)
    listener.onRegister(this);
  return this;
}

代码示例来源:origin: com.yugabyte/cassandra-driver-core

/**
 * Registers the provided listener to be updated with schema change events.
 * <p/>
 * Registering the same listener multiple times is a no-op.
 *
 * @param listener the new {@link SchemaChangeListener} to register.
 * @return this {@code Cluster} object;
 */
public Cluster register(SchemaChangeListener listener) {
  checkNotClosed(manager);
  boolean added = manager.schemaChangeListeners.add(listener);
  if (added)
    listener.onRegister(this);
  return this;
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * Unregisters the provided latency tracking from being updated
 * with host read latencies.
 * <p/>
 * This method is a no-op if {@code tracker} hasn't previously been
 * registered against this Cluster.
 *
 * @param tracker the {@link LatencyTracker} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(LatencyTracker tracker) {
  checkNotClosed(manager);
  boolean removed = manager.latencyTrackers.remove(tracker);
  if (removed)
    tracker.onUnregister(this);
  return this;
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * Unregisters the provided listener from being notified on hosts events.
 * <p/>
 * This method is a no-op if {@code listener} hasn't previously been
 * registered against this Cluster.
 *
 * @param listener the {@link Host.StateListener} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(Host.StateListener listener) {
  checkNotClosed(manager);
  boolean removed = manager.listeners.remove(listener);
  if (removed)
    listener.onUnregister(this);
  return this;
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * Unregisters the provided schema change listener from being updated
 * with schema change events.
 * <p/>
 * This method is a no-op if {@code listener} hasn't previously been
 * registered against this Cluster.
 *
 * @param listener the {@link SchemaChangeListener} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(SchemaChangeListener listener) {
  checkNotClosed(manager);
  boolean removed = manager.schemaChangeListeners.remove(listener);
  if (removed)
    listener.onUnregister(this);
  return this;
}

代码示例来源:origin: com.yugabyte/cassandra-driver-core

/**
 * Unregisters the provided listener from being notified on hosts events.
 * <p/>
 * This method is a no-op if {@code listener} hasn't previously been
 * registered against this Cluster.
 *
 * @param listener the {@link Host.StateListener} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(Host.StateListener listener) {
  checkNotClosed(manager);
  boolean removed = manager.listeners.remove(listener);
  if (removed)
    listener.onUnregister(this);
  return this;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

/**
 * Registers the provided listener to be updated with schema change events.
 * <p/>
 * Registering the same listener multiple times is a no-op.
 *
 * @param listener the new {@link SchemaChangeListener} to register.
 * @return this {@code Cluster} object;
 */
public Cluster register(SchemaChangeListener listener) {
  checkNotClosed(manager);
  boolean added = manager.schemaChangeListeners.add(listener);
  if (added)
    listener.onRegister(this);
  return this;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

/**
 * Unregisters the provided schema change listener from being updated
 * with schema change events.
 * <p/>
 * This method is a no-op if {@code listener} hasn't previously been
 * registered against this Cluster.
 *
 * @param listener the {@link SchemaChangeListener} to unregister.
 * @return this {@code Cluster} object;
 */
public Cluster unregister(SchemaChangeListener listener) {
  checkNotClosed(manager);
  boolean removed = manager.schemaChangeListeners.remove(listener);
  if (removed)
    listener.onUnregister(this);
  return this;
}

相关文章