本文整理汇总了Java中com.datastax.driver.core.policies.FallthroughRetryPolicy类的典型用法代码示例。如果您正苦于以下问题:Java FallthroughRetryPolicy类的具体用法?Java FallthroughRetryPolicy怎么用?Java FallthroughRetryPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FallthroughRetryPolicy类属于com.datastax.driver.core.policies包,在下文中一共展示了FallthroughRetryPolicy类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: primeAndExecuteQueries
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private void primeAndExecuteQueries(String[] primed, String[] queries) throws Exception {
SuccessResult result = getSampleSuccessResult();
for (String primeQuery : primed) {
server.prime(when(primeQuery).then(result));
}
try (com.datastax.driver.core.Cluster driverCluster =
defaultBuilder(server.getCluster())
.withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
.build()) {
Session session = driverCluster.connect();
server.getCluster().clearLogs();
for (String executeQuery : queries) {
SimpleStatement stmt = new SimpleStatement(executeQuery);
stmt.setDefaultTimestamp(100);
session.execute(stmt);
}
}
}
开发者ID:datastax,项目名称:simulacron,代码行数:20,代码来源:ActivityLogIntegrationTest.java
示例2: testShouldMarkPeerQueriesAsNonPrimed
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
@Test
public void testShouldMarkPeerQueriesAsNonPrimed() throws Exception {
server.getCluster().clearLogs();
try (com.datastax.driver.core.Cluster driverCluster =
defaultBuilder(server.getCluster())
.withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
.build()) {
driverCluster.init();
}
// verify for node level filter: primed. This should be empty as no primed queries were made
// other than internal.
List<QueryLog> queryLogs =
getAllQueryLogs(server.getLogs(server.getCluster().getName() + "?filter=primed"));
assertThat(queryLogs).isEmpty();
// non primed should have the internal peer queries.
queryLogs =
getAllQueryLogs(server.getLogs(server.getCluster().getName() + "?filter=nonprimed"));
assertThat(queryLogs).isNotEmpty();
}
开发者ID:datastax,项目名称:simulacron,代码行数:22,代码来源:ActivityLogIntegrationTest.java
示例3: cqlSessionForHintsPoller
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
public HintsPollerCQLSession cqlSessionForHintsPoller(CassandraConfiguration configuration) {
// Nodes can register themselves in ZooKeeper to help figure out which hosts are in this data center.
configuration.withZooKeeperHostDiscovery(_curator);
// Hints Poller only need 1 connection per host since all this is used for is single-threaded polling of the hints table.
// We could also have a new property in the CassandraConfiguration yaml's just for the HintsPoller sake.
CqlCluster cqlCluster = configuration.cql()
.metricRegistry(_metricRegistry)
.disableClusterMetrics()
.maxConnectionsPerHost(1)
.coreConnectionsPerHost(1)
.loadBalancingPolicy(new SelectedHostLoadBalancingPolicy())
.retryPolicy(FallthroughRetryPolicy.INSTANCE)
.cluster();
_lifeCycle.manage(cqlCluster);
return new HintsPollerCQLSession(_lifeCycle, cqlCluster);
}
开发者ID:bazaarvoice,项目名称:emodb,代码行数:20,代码来源:CassandraFactory.java
示例4: testRetryPolicyParsing
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
@Test
public void testRetryPolicyParsing() throws Exception
{
String retryPolicyStr = "DefaultRetryPolicy";
System.out.println(retryPolicyStr);
assertTrue(Utils.parseRetryPolicy(retryPolicyStr) instanceof DefaultRetryPolicy);
System.out.println("====================");
retryPolicyStr = "DowngradingConsistencyRetryPolicy";
System.out.println(retryPolicyStr);
assertTrue(Utils.parseRetryPolicy(retryPolicyStr) instanceof DowngradingConsistencyRetryPolicy);
System.out.println("====================");
retryPolicyStr = "FallthroughRetryPolicy";
System.out.println(retryPolicyStr);
assertTrue(Utils.parseRetryPolicy(retryPolicyStr) instanceof FallthroughRetryPolicy);
System.out.println("====================");
}
开发者ID:adejanovski,项目名称:cassandra-jdbc-wrapper,代码行数:19,代码来源:UtilsUnitTest.java
示例5: setRetryPolicy
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
/**
* Derive the retry policy from the given string to the implementation. Defaults to {@link DefaultRetryPolicy}.
*
* @param retryPolicy
* The name of the retry policy to use. Can be "downgrading" {@link DowngradingConsistencyRetryPolicy} or
* "fallthrough" {@link FallthroughRetryPolicy}. Everything else defaults to
* Policies.defaultRetryPolicy()
*/
public void setRetryPolicy(String retryPolicy) {
switch(retryPolicy) {
case "downgrading":
setRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
break;
case "fallthrough":
setRetryPolicy(FallthroughRetryPolicy.INSTANCE);
break;
default:
setRetryPolicy(Policies.defaultRetryPolicy());
break;
}
}
开发者ID:nea,项目名称:vertx-mod-cassandra-persistor,代码行数:24,代码来源:CassandraPersistor.java
示例6: populateRetrytPolicy
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private Builder populateRetrytPolicy(Map<String, String> properties, Builder builder) throws DataServiceFault {
String retryPolicy = properties.get(DBConstants.Cassandra.RETRY_POLICY);
if (retryPolicy != null) {
if ("DefaultRetryPolicy".equals(retryPolicy)) {
builder = builder.withRetryPolicy(DefaultRetryPolicy.INSTANCE);
} else if ("DowngradingConsistencyRetryPolicy".equals(retryPolicy)) {
builder = builder.withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
} else if ("FallthroughRetryPolicy".equals(retryPolicy)) {
builder = builder.withRetryPolicy(FallthroughRetryPolicy.INSTANCE);
} else if ("LoggingDefaultRetryPolicy".equals(retryPolicy)) {
builder = builder.withRetryPolicy(new LoggingRetryPolicy(DefaultRetryPolicy.INSTANCE));
} else if ("LoggingDowngradingConsistencyRetryPolicy".equals(retryPolicy)) {
builder = builder.withRetryPolicy(new LoggingRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE));
} else if ("LoggingFallthroughRetryPolicy".equals(retryPolicy)) {
builder = builder.withRetryPolicy(new LoggingRetryPolicy(FallthroughRetryPolicy.INSTANCE));
} else {
throw new DataServiceFault("Invalid Cassandra retry policy: " + retryPolicy);
}
}
return builder;
}
开发者ID:wso2,项目名称:carbon-data,代码行数:22,代码来源:CassandraConfig.java
示例7: query
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private void query(String statement, ClusterSpec cluster) throws Exception {
try (com.datastax.driver.core.Cluster driverCluster =
com.datastax.driver.core.Cluster.builder()
.addContactPointsWithPorts(cluster.node(0).inetSocketAddress())
.withNettyOptions(SimulacronDriverSupport.nonQuietClusterCloseOptions)
.withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
.build()) {
driverCluster.connect().execute(statement);
}
}
开发者ID:datastax,项目名称:simulacron,代码行数:11,代码来源:ActivityLogIntegrationTest.java
示例8: prepare
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private PreparedStatement prepare() throws Exception {
try (com.datastax.driver.core.Cluster driverCluster =
defaultBuilder(server.getCluster())
.withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
.build()) {
return driverCluster.connect().prepare(query);
}
}
开发者ID:datastax,项目名称:simulacron,代码行数:9,代码来源:ErrorResultIntegrationTest.java
示例9: prepareAndQuery
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private ResultSet prepareAndQuery() throws Exception {
try (com.datastax.driver.core.Cluster driverCluster =
defaultBuilder(server.getCluster())
.withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
.build()) {
Session session = driverCluster.connect();
PreparedStatement prepared = session.prepare(query);
return session.execute(prepared.bind());
}
}
开发者ID:datastax,项目名称:simulacron,代码行数:11,代码来源:ErrorResultIntegrationTest.java
示例10: query
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private ResultSet query(Statement statement) throws Exception {
try (com.datastax.driver.core.Cluster driverCluster =
defaultBuilder(server.getCluster())
.withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
.build()) {
return driverCluster.connect().execute(statement);
}
}
开发者ID:datastax,项目名称:simulacron,代码行数:9,代码来源:ErrorResultIntegrationTest.java
示例11: returnsFallthroughRetryPolicyInstance
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
@Test
public void returnsFallthroughRetryPolicyInstance() throws Exception {
final FallthroughRetryPolicyFactory factory = new FallthroughRetryPolicyFactory();
final FallthroughRetryPolicy policy = (FallthroughRetryPolicy) factory.build();
assertThat(policy).isSameAs(FallthroughRetryPolicy.INSTANCE);
}
开发者ID:composable-systems,项目名称:dropwizard-cassandra,代码行数:9,代码来源:FallthroughRetryPolicyFactoryTest.java
示例12: populateRetrytPolicy
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
private Cluster.Builder populateRetrytPolicy(Properties properties, Cluster.Builder builder) {
String retryPolicy = properties.getProperty(CassandraStoreParameters.RETRY_POLICY);
if (retryPolicy != null) {
switch (retryPolicy) {
case "DefaultRetryPolicy":
builder = builder.withRetryPolicy(DefaultRetryPolicy.INSTANCE);
break;
case "DowngradingConsistencyRetryPolicy":
builder = builder.withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
break;
case "FallthroughRetryPolicy":
builder = builder.withRetryPolicy(FallthroughRetryPolicy.INSTANCE);
break;
case "LoggingDefaultRetryPolicy":
builder = builder.withRetryPolicy(new LoggingRetryPolicy(DefaultRetryPolicy.INSTANCE));
break;
case "LoggingDowngradingConsistencyRetryPolicy":
builder = builder.withRetryPolicy(new LoggingRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE));
break;
case "LoggingFallthroughRetryPolicy":
builder = builder.withRetryPolicy(new LoggingRetryPolicy(FallthroughRetryPolicy.INSTANCE));
break;
default:
LOG.error("Unsupported retry policy : {} ", retryPolicy);
break;
}
}
return builder;
}
开发者ID:apache,项目名称:gora,代码行数:30,代码来源:CassandraClient.java
示例13: build
import com.datastax.driver.core.policies.FallthroughRetryPolicy; //导入依赖的package包/类
@Override
public RetryPolicy build() {
return FallthroughRetryPolicy.INSTANCE;
}
开发者ID:composable-systems,项目名称:dropwizard-cassandra,代码行数:5,代码来源:FallthroughRetryPolicyFactory.java
注:本文中的com.datastax.driver.core.policies.FallthroughRetryPolicy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论