Elffuss BraidHub

kikocis/java-driver public

Fix bug in JAVA-505 fix.
Changeset5b222ed3b5fe01b6c0af393d392aad94ea129205675716a836f530607b9d3f78
Authorolim7t <omichallat+github@gmail.com> · 2014-11-28 10:02 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2014-11-28 10:02 +01:00
Parents697b75f26387

Browse the files at this changeset

2 files changed

modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +7 −7
@@ -84,17 +84,20 @@
8484 final AtomicBoolean markForTrash = new AtomicBoolean();
8585
8686 /**
87- * Create a new connection to a Cassandra node.
87+ * Create a new connection to a Cassandra node and associate it with a pool.
8888 *
8989 * The connection is open and initialized by the constructor.
9090 *
91+ * Note that an existing connection can also be associated to a pool later with {@link #setPool(HostConnectionPool)}
92+ *
9193 * @throws ConnectionException if the connection attempts fails or is
9294 * refused by the server.
9395 */
94- Connection(String name, InetSocketAddress address, Factory factory) throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException {
96+ Connection(String name, InetSocketAddress address, Factory factory, HostConnectionPool pool) throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException {
9597 this.address = address;
9698 this.factory = factory;
9799 this.name = name;
100+ this.poolRef.set(pool);
98101
99102 ClientBootstrap bootstrap = factory.newBootstrap();
100103 ProtocolOptions protocolOptions = factory.configuration.getProtocolOptions();
@@ -126,12 +129,9 @@
126129
127130 /**
128131 * Create a new connection to a Cassandra node, and associate it to a connection pool.
129- *
130- * Note that an existing connection can also be associated to a pool with {@link #setPool(HostConnectionPool)}
131132 */
132- Connection(String name, InetSocketAddress address, Factory factory, HostConnectionPool pool) throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException {
133- this(name, address, factory);
134- this.poolRef.set(pool);
133+ Connection(String name, InetSocketAddress address, Factory factory) throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException {
134+ this(name, address, factory, null);
135135 }
136136
137137 private static String extractMessage(Throwable t) {
modified driver-core/src/test/java/com/datastax/driver/core/ReconnectionTest.java +0 −1
@@ -13,7 +13,6 @@
1313
1414 import com.google.common.base.Charsets;
1515 import com.google.common.collect.ImmutableMap;
16-import org.mockito.Mockito;
1716 import org.testng.annotations.Test;
1817
1918 import static org.assertj.core.api.Assertions.assertThat;