kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 12616ebdc305199270a87e7d6de6b6970e904bc8deff3c6c0aa7b44a4022df4b |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2015-04-29 19:00 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-04-29 19:00 +02:00 |
| Parents | 77ca7d6c3905 |
2 files changed
modified driver-core/src/main/java/com/datastax/driver/core/policies/ConstantSpeculativeExecutionPolicy.java +7 −7
| @@ -33,18 +33,18 @@ | ||
| 33 | 33 | /** |
| 34 | 34 | * Builds a new instance. |
| 35 | 35 | * |
| 36 | - * @param maxSpeculativeExecutions the number of speculative executions. Must be strictly positive. | |
| 37 | 36 | * @param constantDelayMillis the delay between each speculative execution. Must be strictly positive. |
| 38 | - * | |
| 37 | + * @param maxSpeculativeExecutions the number of speculative executions. Must be strictly positive. | |
| 38 | + * | |
| 39 | 39 | * @throws IllegalArgumentException if one of the arguments does not respect the preconditions above. |
| 40 | 40 | */ |
| 41 | - public ConstantSpeculativeExecutionPolicy(final int maxSpeculativeExecutions, final long constantDelayMillis) { | |
| 42 | - this.maxSpeculativeExecutions = maxSpeculativeExecutions; | |
| 43 | - this.constantDelayMillis = constantDelayMillis; | |
| 44 | - Preconditions.checkArgument(maxSpeculativeExecutions > 0, | |
| 45 | - "number of speculative executions must be strictly positive (was %d)", maxSpeculativeExecutions); | |
| 41 | + public ConstantSpeculativeExecutionPolicy(final long constantDelayMillis, final int maxSpeculativeExecutions) { | |
| 46 | 42 | Preconditions.checkArgument(constantDelayMillis > 0, |
| 47 | 43 | "delay must be strictly positive (was %d)", constantDelayMillis); |
| 44 | + Preconditions.checkArgument(maxSpeculativeExecutions > 0, | |
| 45 | + "number of speculative executions must be strictly positive (was %d)", maxSpeculativeExecutions); | |
| 46 | + this.constantDelayMillis = constantDelayMillis; | |
| 47 | + this.maxSpeculativeExecutions = maxSpeculativeExecutions; | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | @Override |
modified driver-core/src/test/java/com/datastax/driver/core/SpeculativeExecutionTest.java +1 −1
| @@ -52,7 +52,7 @@ | ||
| 52 | 52 | cluster = Cluster.builder() |
| 53 | 53 | .addContactPoint(CCMBridge.ipOfNode(2)) |
| 54 | 54 | .withLoadBalancingPolicy(loadBalancingPolicy) |
| 55 | - .withSpeculativeExecutionPolicy(new ConstantSpeculativeExecutionPolicy(1, speculativeExecutionDelay)) | |
| 55 | + .withSpeculativeExecutionPolicy(new ConstantSpeculativeExecutionPolicy(speculativeExecutionDelay, 1)) | |
| 56 | 56 | .withQueryOptions(new QueryOptions().setDefaultIdempotence(true)) |
| 57 | 57 | .withRetryPolicy(new CustomRetryPolicy()) |
| 58 | 58 | .build(); |