Elffuss BraidHub

kikocis/java-driver public

Merge pull request #319 from tolbertam/netty4_0_27

Upgrade to Netty 4.0.27.
Changesetd4c4ae736c90213f720bc0df07e262065c103dac86af28bcb655723dfdc72115
AuthorOlivier Michallat <olim7t@users.noreply.github.com> · 2015-04-09 14:35 +02:00
CommitterOlivier Michallat <olim7t@users.noreply.github.com> · 2015-04-09 14:35 +02:00
Parents0507613e1433, 5a733475be34

Browse the files at this changeset

5 files changed

modified driver-core/CHANGELOG.rst +1 −1
@@ -22,7 +22,7 @@
2222 - [new feature] Add getObject to BoundStatement and Row (JAVA-584)
2323 - [improvement] Improve connection pool resizing algorithm (JAVA-419)
2424 - [bug] Fix race condition between pool expansion and shutdown (JAVA-599)
25-- [improvement] Upgrade Netty to 4.0.26 (JAVA-622)
25+- [improvement] Upgrade Netty to 4.0.27 (JAVA-622)
2626 - [improvement] Coalesce frames before flushing them to the connection
2727 (JAVA-562)
2828 - [improvement] Rename threads to indicate that they are for the driver
modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +1 −1
@@ -110,12 +110,12 @@
110110 try {
111111 // Wait until the connection attempt succeeds or fails.
112112 this.channel = future.awaitUninterruptibly().channel();
113+ this.factory.allChannels.add(this.channel);
113114 if (!future.isSuccess()) {
114115 if (logger.isDebugEnabled())
115116 logger.debug(String.format("%s Error connecting to %s%s", this, address, extractMessage(future.cause())));
116117 throw defunct(new TransportException(address, "Cannot connect", future.cause()));
117118 }
118- this.factory.allChannels.add(this.channel);
119119 channel.closeFuture().addListener(new ChannelCloseListener());
120120 } finally {
121121 writer.decrementAndGet();
modified driver-core/src/test/java/com/datastax/driver/core/ClusterInitTest.java +37 −16
@@ -15,30 +15,26 @@
1515 */
1616 package com.datastax.driver.core;
1717
18-import java.net.InetAddress;
19-import java.util.List;
20-import java.util.concurrent.TimeUnit;
21-
18+import com.datastax.driver.core.exceptions.NoHostAvailableException;
19+import com.datastax.driver.core.policies.ConstantReconnectionPolicy;
20+import com.datastax.driver.core.querybuilder.Insert;
21+import com.datastax.driver.core.utils.UUIDs;
2222 import com.google.common.collect.Lists;
23-import org.mockito.Mockito;
2423 import org.slf4j.Logger;
2524 import org.slf4j.LoggerFactory;
2625 import org.testng.annotations.Test;
2726
28-import static org.assertj.core.api.Assertions.assertThat;
29-import static org.assertj.core.api.Assertions.fail;
30-import static org.mockito.Mockito.atMost;
31-import static org.mockito.Mockito.spy;
32-import static org.mockito.Mockito.times;
33-import static org.mockito.Mockito.verify;
34-
35-import com.datastax.driver.core.policies.ConstantReconnectionPolicy;
36-import com.datastax.driver.core.querybuilder.Insert;
37-import com.datastax.driver.core.utils.UUIDs;
27+import java.net.InetAddress;
28+import java.net.InetSocketAddress;
29+import java.util.Collections;
30+import java.util.List;
31+import java.util.concurrent.TimeUnit;
32+import java.util.concurrent.TimeoutException;
3833
3934 import static com.datastax.driver.core.FakeHost.Behavior.THROWING_CONNECT_TIMEOUTS;
40-
4135 import static com.datastax.driver.core.querybuilder.QueryBuilder.insertInto;
36+import static org.assertj.core.api.Assertions.fail;
37+import static org.mockito.Mockito.*;
4238
4339 public class ClusterInitTest {
4440 private static final Logger logger = LoggerFactory.getLogger(ClusterInitTest.class);
@@ -110,6 +106,31 @@
110106 }
111107 }
112108
109+ /**
110+ * <p>
111+ * Validates that a Cluster that was never able to successfully establish connection a session can be closed
112+ * properly.
113+ *
114+ * @test_category connection
115+ * @expected_result Cluster closes within 1 second.
116+ */
117+ @Test(groups="unit")
118+ public void should_be_able_to_close_cluster_that_never_successfully_connected() throws Exception {
119+ Cluster cluster = Cluster.builder()
120+ .addContactPointsWithPorts(Collections.singleton(new InetSocketAddress("127.0.0.1", 65534)))
121+ .build();
122+ try {
123+ cluster.connect();
124+ fail("Should not have been able to connect.");
125+ } catch(NoHostAvailableException e) {} // Expected.
126+ CloseFuture closeFuture = cluster.closeAsync();
127+ try {
128+ closeFuture.get(1, TimeUnit.SECONDS);
129+ } catch(TimeoutException e) {
130+ fail("Close Future did not complete quickly.");
131+ }
132+ }
133+
113134 private void fakePeerRowsInNode1() {
114135 Cluster cluster = null;
115136 try {
modified driver-examples/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceIT.java +1 −1
@@ -58,7 +58,7 @@
5858 }
5959
6060 private CompositeOption nettyBundles() {
61- final String nettyVersion = "4.0.26.Final";
61+ final String nettyVersion = "4.0.27.Final";
6262 return new CompositeOption() {
6363
6464 @Override public Option[] getOptions() {
modified pom.xml +1 −1
@@ -51,7 +51,7 @@
5151 Check with the spark-cassandra-connector team before upgrading this.
5252 -->
5353 <guava.version>14.0.1</guava.version>
54- <netty.version>4.0.26.Final</netty.version>
54+ <netty.version>4.0.27.Final</netty.version>
5555 <metrics.version>3.0.2</metrics.version>
5656 <snappy.version>1.0.5</snappy.version>
5757 <lz4.version>1.2.0</lz4.version>