本文整理了Java中com.datastax.driver.core.Cluster.isClosed()
方法的一些代码示例,展示了Cluster.isClosed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cluster.isClosed()
方法的具体详情如下:
包路径:com.datastax.driver.core.Cluster
类名称:Cluster
方法名:isClosed
[英]Whether this Cluster instance has been closed.
Note that this method returns true as soon as one of the close methods ( #closeAsync or #close) has been called, it does not guarantee that the closing is done. If you want to guarantee that the closing is done, you can call close() and wait until it returns (or call the get method on closeAsync() with a very short timeout and check this doesn't timeout).
[中]此群集实例是否已关闭。
请注意,只要调用了其中一个close方法(#closeAsync或#close),该方法就会返回true,但它并不保证关闭完成。如果要保证关闭已完成,可以调用close()并等待它返回(或者在closeAsync()上调用get方法,并在很短的超时时间内检查是否超时)。
代码示例来源:origin: apache/storm
/**
* {@inheritDoc}
*/
@Override
public boolean isClose() {
return this.cluster.isClosed();
}
代码示例来源:origin: prestodb/presto
@Override
protected synchronized Cluster delegate()
{
checkState(!closed, "Cluster has been closed");
if (delegate == null) {
delegate = supplier.get();
}
if (delegate.isClosed()) {
log.warn("Cluster has been closed internally");
delegate = supplier.get();
}
verify(!delegate.isClosed(), "Newly created cluster has been immediately closed");
return delegate;
}
代码示例来源:origin: apache/usergrid
@Override
public synchronized Cluster getCluster(){
// ensure we can build the cluster if it was previously closed
if ( cluster == null || cluster.isClosed() ){
cluster = buildCluster();
}
return cluster;
}
代码示例来源:origin: apache/storm
/**
* {@inheritDoc}
*/
@Override
public void close() {
if (cluster != null && !cluster.isClosed()) {
LOG.info("Try to close connection to cluster: {}", cluster.getClusterName());
session.close();
cluster.close();
}
}
代码示例来源:origin: apache/storm
/**
* {@inheritDoc}
*/
@Override
protected SimpleClient make(Map<String, Object> topoConf) {
Cluster cluster = this.context.getWorkerBean(Cluster.class, topoConf);
if (cluster.isClosed()) {
LOG.warn("Cluster is closed - trigger new initialization!");
cluster = this.context.getWorkerBean(Cluster.class, topoConf, true);
}
CassandraConf config = this.context.getWorkerBean(CassandraConf.class, topoConf);
return new DefaultClient(cluster, config.getKeyspace());
}
}
代码示例来源:origin: apache/ignite
/** Closes Cassandra driver session. */
public static void closeSession(Session driverSes) {
if (driverSes == null)
return;
Cluster cluster = driverSes.getCluster();
if (!driverSes.isClosed())
U.closeQuiet(driverSes);
if (!cluster.isClosed())
U.closeQuiet(cluster);
}
代码示例来源:origin: apache/usergrid
@Test
public void testConnectCloseCluster() {
Cluster cluster = dataStaxCluster.getCluster();
assertTrue(!cluster.isClosed());
cluster.close();
assertTrue(cluster.isClosed());
// validate getCluster will re-init the cluster
cluster = dataStaxCluster.getCluster();
assertTrue(!cluster.isClosed());
}
代码示例来源:origin: hugegraph/hugegraph
@Override
public final synchronized boolean opened() {
return (this.cluster != null && !this.cluster.isClosed());
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Override
public boolean isClosed() {
return delegate().isClosed();
}
}
代码示例来源:origin: hugegraph/hugegraph
@Override
protected synchronized void doClose() {
if (this.cluster != null && !this.cluster.isClosed()) {
this.cluster.close();
}
}
代码示例来源:origin: hugegraph/hugegraph
public final void checkClusterConnected() {
E.checkState(this.cluster != null,
"Cassandra cluster has not been initialized");
E.checkState(!this.cluster.isClosed(),
"Cassandra cluster has been closed");
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
protected void closeTestCluster() {
if (cluster != null && !cluster.isClosed())
executeNoFail(
new Runnable() {
@Override
public void run() {
cluster.close();
}
},
false);
cluster = null;
session = null;
keyspace = null;
}
代码示例来源:origin: org.apache.storm/storm-cassandra
/**
* {@inheritDoc}
*/
@Override
public boolean isClose() {
return this.cluster.isClosed();
}
代码示例来源:origin: hugegraph/hugegraph
int port = config.get(CassandraOptions.CASSANDRA_PORT);
assert this.cluster == null || this.cluster.isClosed();
Builder builder = Cluster.builder()
.addContactPoints(hosts.split(","))
代码示例来源:origin: com.baidu.hugegraph/hugegraph-cassandra
@Override
protected synchronized void doClose() {
if (this.cluster != null && !this.cluster.isClosed()) {
this.cluster.close();
}
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
@Override
public boolean isClosed() {
return delegate().isClosed();
}
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
@Override
public boolean isClosed() {
return delegate().isClosed();
}
}
代码示例来源:origin: prestodb/tempto
private void ensureConnected()
{
checkState(!cluster.isClosed(), "Trying to connect using closed Cluster");
if (session == null || session.isClosed()) {
session = cluster.connect();
}
}
代码示例来源:origin: com.teradata.tempto/tempto-core
private void ensureConnected()
{
checkState(!cluster.isClosed(), "Trying to connect using closed Cluster");
if (session == null || session.isClosed()) {
session = cluster.connect();
}
}
代码示例来源:origin: org.apache.storm/storm-cassandra
/**
* {@inheritDoc}
*/
@Override
public void close() {
if (cluster != null && !cluster.isClosed()) {
LOG.info("Try to close connection to cluster: {}", cluster.getClusterName());
session.close();
cluster.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!