本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例13: testShouldAdaptExtractWriteTypes
import com.datastax.driver.core.WriteType; //导入依赖的package包/类
@Test
public void testShouldAdaptExtractWriteTypes() {
for (WriteType w : WriteType.values()) {
assertThat(extract(adapt(w))).isSameAs(w);
}
}
示例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);
}
示例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);
}