当前位置: 首页>>代码示例>>Java>>正文


Java WriteType类代码示例

本文整理汇总了Java中com.datastax.driver.core.WriteType的典型用法代码示例。如果您正苦于以下问题:Java WriteType类的具体用法?Java WriteType怎么用?Java WriteType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WriteType类属于com.datastax.driver.core包,在下文中一共展示了WriteType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testShouldAdaptWriteTypes

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Test
public void testShouldAdaptWriteTypes() {
  assertThat(adapt(WriteType.SIMPLE)).isSameAs(SIMPLE);
  assertThat(adapt(WriteType.BATCH)).isSameAs(BATCH);
  assertThat(adapt(WriteType.UNLOGGED_BATCH)).isSameAs(UNLOGGED_BATCH);
  assertThat(adapt(WriteType.COUNTER)).isSameAs(COUNTER);
  assertThat(adapt(WriteType.BATCH_LOG)).isSameAs(BATCH_LOG);
  assertThat(adapt(WriteType.CAS)).isSameAs(CAS);
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:10,代码来源:DriverTypeAdaptersTest.java

示例2: testShouldExtractWriteTypes

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Test
public void testShouldExtractWriteTypes() {
  assertThat(extract(SIMPLE)).isSameAs(WriteType.SIMPLE);
  assertThat(extract(BATCH)).isSameAs(WriteType.BATCH);
  assertThat(extract(UNLOGGED_BATCH)).isSameAs(WriteType.UNLOGGED_BATCH);
  assertThat(extract(COUNTER)).isSameAs(WriteType.COUNTER);
  assertThat(extract(BATCH_LOG)).isSameAs(WriteType.BATCH_LOG);
  assertThat(extract(CAS)).isSameAs(WriteType.CAS);
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:10,代码来源:DriverTypeAdaptersTest.java

示例3: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses,
		int receivedResponses, int wTime) {
	if (wTime < writeAttempts) {
		return RetryDecision.retry(cl);
	}
	return RetryDecision.rethrow();
}
 
开发者ID:abulbasar,项目名称:cassandra-java-driver-examples,代码行数:9,代码来源:CustomRetryPolicy.java

示例4: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(
    Statement stmt,
    ConsistencyLevel cl,
    WriteType type,
    int required,
    int received,
    int retry) {

  return null != stmt && stmt.isIdempotent()
      ? RetryDecision.retry(cl)
      : DefaultRetryPolicy.INSTANCE.onWriteTimeout(stmt, cl, type, required, received, retry);
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:14,代码来源:CassandraStorage.java

示例5: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(Statement statement, ConsistencyLevel cl, WriteType writeType, int requiredAcks, int receivedAcks, int nbRetry) {
    final RetryDecision decision = policy.onWriteTimeout(statement, cl, writeType, requiredAcks, receivedAcks, nbRetry);
    this.decision = decision;
    return decision;

}
 
开发者ID:lookout,项目名称:cassandra-health-check,代码行数:8,代码来源:RecollectingRetryPolicy.java

示例6: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(
    Statement statement, ConsistencyLevel cl, WriteType writeType, int requiredAcks,
    int receivedAcks, int nbRetry
) {
    if (nbRetry != 0) {
        return RetryDecision.rethrow();
    }

    // If the batch log write failed, retry the operation as this might just be we were
    // unlucky at picking candidates
    return writeType == WriteType.BATCH_LOG ? RetryDecision.retry(cl) : RetryDecision.rethrow();
}
 
开发者ID:spotify,项目名称:heroic,代码行数:14,代码来源:AggressiveRetryPolicy.java

示例7: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
public RetryDecision onWriteTimeout(Statement statement, 
                                    ConsistencyLevel cl, 
                                    WriteType writeType, int requiredAcks, 
                                    int receivedAcks, int nbRetry) {
    if (nbRetry >= numRetries)
        return RetryDecision.rethrow();

    return RetryDecision.retry(cl);
}
 
开发者ID:brianmhess,项目名称:cassandra-loader,代码行数:10,代码来源:LoaderRetryPolicy.java

示例8: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt,
    int requiredResponses, int receivedResponses, int wTime) {
  if (wTime >= writeAttempts)
    return RetryDecision.rethrow();

  return RetryDecision.retry(cl);
}
 
开发者ID:openstack,项目名称:monasca-persister,代码行数:9,代码来源:MonascaRetryPolicy.java

示例9: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(final Statement statement, final ConsistencyLevel cl, final WriteType writeType,
                                    final int requiredAcks, final int receivedAcks, final int nbRetry) {

  final RetryDecision decision = delegate.onWriteTimeout(statement, cl, writeType, requiredAcks, receivedAcks, nbRetry);
  for (final TagMetrics c : tagMetrics) {
    c.writeTimeouts.inc();
  }
  return decision;
}
 
开发者ID:outbrain,项目名称:ob1k,代码行数:11,代码来源:RetryPolicyWithMetrics.java

示例10: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl,
                                    WriteType wt, int requiredResponses,
                                    int receivedResponses, int wTime) {
    if (wTime < writeAttempts) {
        LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " +
                               "consistency %s, writeType %s, requiredResponse %d, " +
                               "receivedResponse %d, rTime %d",
                stmnt, cl, wt.toString(), requiredResponses, receivedResponses, wTime));
        return RetryDecision.retry(cl);
    }
    return RetryDecision.rethrow();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:14,代码来源:RetryNTimes.java

示例11: firstTimeRetryOnWriteTimeout_shouldRetry

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Test
public void firstTimeRetryOnWriteTimeout_shouldRetry() throws Exception {
    RetryNTimes retryPolicy = new RetryNTimes(3, 3, 3);
    Statement mockStatement = mock( Statement.class );
    RetryPolicy.RetryDecision retryResult = retryPolicy.onWriteTimeout(mockStatement, ConsistencyLevel.LOCAL_ONE, WriteType.BATCH, 1, 0, 0);
    RetryPolicy.RetryDecision retryExpected = RetryPolicy.RetryDecision.retry(ConsistencyLevel.LOCAL_ONE);
    assertRetryDecisionEquals(retryExpected, retryResult);
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:9,代码来源:RetryNTimesTest.java

示例12: maxTimeRetryOnWriteTimeout_shouldRethrow

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Test
public void maxTimeRetryOnWriteTimeout_shouldRethrow() throws Exception {
    RetryNTimes retryPolicy = new RetryNTimes(3, 3, 3);
    Statement mockStatement = mock( Statement.class );

    RetryPolicy.RetryDecision retryResult = retryPolicy.onWriteTimeout(mockStatement, ConsistencyLevel.LOCAL_ONE, WriteType.BATCH, 1, 0, 3);
    RetryPolicy.RetryDecision retryExpected = RetryPolicy.RetryDecision.rethrow();
    assertRetryDecisionEquals(retryExpected, retryResult);
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:10,代码来源:RetryNTimesTest.java

示例13: testShouldAdaptExtractWriteTypes

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Test
public void testShouldAdaptExtractWriteTypes() {
  for (WriteType w : WriteType.values()) {
    assertThat(extract(adapt(w))).isSameAs(w);
  }
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:7,代码来源:DriverTypeAdaptersTest.java

示例14: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(Statement statement, ConsistencyLevel cl, WriteType writeType,
    int requiredAcks, int receivedAcks, int nbRetry) {
  return RetryDecision.retry(ConsistencyLevel.ONE);
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:6,代码来源:ZipkinRetryPolicy.java

示例15: onWriteTimeout

import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Override
public RetryDecision onWriteTimeout(Statement statement, ConsistencyLevel cl, WriteType writeType, int requiredAcks, int receivedAcks, int nbRetry)
{
    return DefaultRetryPolicy.INSTANCE.onWriteTimeout(statement, cl, writeType, requiredAcks, receivedAcks, nbRetry);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:6,代码来源:BackoffRetryPolicy.java


注:本文中的com.datastax.driver.core.WriteType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。