Java 类com.datastax.driver.core.WriteType 实例源码

项目:simulacron    文件:DriverTypeAdaptersTest.java   
@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);
}
项目:simulacron    文件:DriverTypeAdaptersTest.java   
@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);
}
项目:cassandra-java-driver-examples    文件:CustomRetryPolicy.java   
@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();
}
项目:cassandra-reaper    文件:CassandraStorage.java   
@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);
}
项目:cassandra-health-check    文件:RecollectingRetryPolicy.java   
@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;

}
项目:heroic    文件:AggressiveRetryPolicy.java   
@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();
}
项目:cassandra-loader    文件:LoaderRetryPolicy.java   
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);
}
项目:monasca-persister    文件:MonascaRetryPolicy.java   
@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);
}
项目:ob1k    文件:RetryPolicyWithMetrics.java   
@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;
}
项目:blueflood    文件:RetryNTimes.java   
@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();
}
项目:blueflood    文件:RetryNTimesTest.java   
@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);
}
项目:blueflood    文件:RetryNTimesTest.java   
@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);
}
项目:simulacron    文件:DriverTypeAdaptersTest.java   
@Test
public void testShouldAdaptExtractWriteTypes() {
  for (WriteType w : WriteType.values()) {
    assertThat(extract(adapt(w))).isSameAs(w);
  }
}
项目:zipkin    文件:ZipkinRetryPolicy.java   
@Override
public RetryDecision onWriteTimeout(Statement statement, ConsistencyLevel cl, WriteType writeType,
    int requiredAcks, int receivedAcks, int nbRetry) {
  return RetryDecision.retry(ConsistencyLevel.ONE);
}
项目:zipkin    文件:ZipkinRetryPolicy.java   
@Override
public RetryDecision onWriteTimeout(Statement statement, ConsistencyLevel cl, WriteType writeType,
    int requiredAcks, int receivedAcks, int nbRetry) {
  return RetryDecision.retry(ConsistencyLevel.ONE);
}
项目:presto    文件:BackoffRetryPolicy.java   
@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);
}
项目:copper-engine    文件:AlwaysRetryPolicy.java   
@Override
public RetryDecision onWriteTimeout(Statement statement, ConsistencyLevel cl, WriteType writeType, int requiredAcks, int receivedAcks, int nbRetry) {
    return RetryDecision.retry(cl);
}