kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 9c9a5537845d690335aec043f9e9c1e7dbe523886b1f450292c198361cdbdcdd |
|---|---|
| Author | Alexandre Dutra <adutra@users.noreply.github.com> · 2016-05-02 14:18 +02:00 |
| Committer | Alexandre Dutra <adutra@users.noreply.github.com> · 2016-05-02 14:18 +02:00 |
| Parents | d76375dddc36, 78f817fd23f6 |
3 files changed
modified driver-core/src/test/java/com/datastax/driver/core/CCMCache.java +3 −3
| @@ -271,10 +271,10 @@ | ||
| 271 | 271 | // CCM nodes are started with -Xms500M -Xmx500M |
| 272 | 272 | // and allocate up to 100MB non-heap memory in the general case, |
| 273 | 273 | // to be conservative we treat 1 "slot" as 800Mb. |
| 274 | - // We leave 2 slots out to avoid starving system memory, | |
| 274 | + // We leave 3 slots out to avoid starving system memory, | |
| 275 | 275 | // and we pick a value with a minimum of 1 slot and a maximum of 8 slots. |
| 276 | - // For example, an 8GB VM with ~6.5GB currently available heap will yield 6 slots ((6500/800) - 2 = 6). | |
| 277 | - long slotsAvailable = (freeMemoryMB / ONE_CCM_NODE_MB) - 2; | |
| 276 | + // For example, an 8GB VM with ~6.5GB currently available heap will yield 5 slots ((6500/800) - 3 = 5). | |
| 277 | + long slotsAvailable = (freeMemoryMB / ONE_CCM_NODE_MB) - 3; | |
| 278 | 278 | maximumWeight = Math.min(8, Math.max(1, slotsAvailable)); |
| 279 | 279 | } else { |
| 280 | 280 | maximumWeight = Integer.parseInt(numberOfNodes); |
modified driver-core/src/test/java/com/datastax/driver/core/HostAssert.java +14 −3
| @@ -20,9 +20,11 @@ | ||
| 20 | 20 | import com.datastax.driver.core.policies.LoadBalancingPolicy; |
| 21 | 21 | import org.assertj.core.api.AbstractAssert; |
| 22 | 22 | |
| 23 | +import java.util.concurrent.Callable; | |
| 23 | 24 | import java.util.concurrent.CountDownLatch; |
| 24 | 25 | import java.util.concurrent.TimeUnit; |
| 25 | 26 | |
| 27 | +import static com.datastax.driver.core.ConditionChecker.check; | |
| 26 | 28 | import static org.assertj.core.api.Assertions.assertThat; |
| 27 | 29 | import static org.assertj.core.api.Assertions.fail; |
| 28 | 30 | |
| @@ -72,9 +74,18 @@ | ||
| 72 | 74 | } |
| 73 | 75 | |
| 74 | 76 | public HostAssert isNotReconnectingFromDown() { |
| 75 | - assertThat(actual.getReconnectionAttemptFuture() != null && !actual.getReconnectionAttemptFuture().isDone()) | |
| 76 | - .isFalse(); | |
| 77 | - return this; | |
| 77 | + // Ensure that host is not attempting a reconnect. Because of JAVA-970 we cannot | |
| 78 | + // be sure that there is a race and another pool is created before the host is marked down so we | |
| 79 | + // check to see it stops after 30 seconds. | |
| 80 | + // TODO: Change this to check only once if JAVA-970 is fixed. | |
| 81 | + check().before(30, TimeUnit.SECONDS).that(new Callable<Boolean>() { | |
| 82 | + @Override | |
| 83 | + public Boolean call() throws Exception { | |
| 84 | + // Whether or not host is down and reconnection attempt is in progress. | |
| 85 | + return actual.getReconnectionAttemptFuture() != null && !actual.getReconnectionAttemptFuture().isDone(); | |
| 86 | + } | |
| 87 | + }).becomesFalse(); | |
| 88 | + return this.isDown(); | |
| 78 | 89 | } |
| 79 | 90 | |
| 80 | 91 | public HostAssert comesUpWithin(long duration, TimeUnit unit) { |
modified driver-examples/osgi/pom.xml +15 −0
| @@ -220,6 +220,21 @@ | ||
| 220 | 220 | </plugins> |
| 221 | 221 | </build> |
| 222 | 222 | </profile> |
| 223 | + <profile> | |
| 224 | + <id>short</id> | |
| 225 | + <properties> | |
| 226 | + <test.groups>unit,short</test.groups> | |
| 227 | + <test.skip>false</test.skip> | |
| 228 | + </properties> | |
| 229 | + </profile> | |
| 230 | + | |
| 231 | + <profile> | |
| 232 | + <id>long</id> | |
| 233 | + <properties> | |
| 234 | + <test.groups>unit,short,long</test.groups> | |
| 235 | + <test.skip>false</test.skip> | |
| 236 | + </properties> | |
| 237 | + </profile> | |
| 223 | 238 | </profiles> |
| 224 | 239 | |
| 225 | 240 | <licenses> |