kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 5b222ed3b5fe01b6c0af393d392aad94ea129205675716a836f530607b9d3f78 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-11-28 10:02 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-11-28 10:02 +01:00 |
| Parents | 697b75f26387 |
2 files changed
modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +7 −7
| @@ -84,17 +84,20 @@ | ||
| 84 | 84 | final AtomicBoolean markForTrash = new AtomicBoolean(); |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Create a new connection to a Cassandra node. | |
| 87 | + * Create a new connection to a Cassandra node and associate it with a pool. | |
| 88 | 88 | * |
| 89 | 89 | * The connection is open and initialized by the constructor. |
| 90 | 90 | * |
| 91 | + * Note that an existing connection can also be associated to a pool later with {@link #setPool(HostConnectionPool)} | |
| 92 | + * | |
| 91 | 93 | * @throws ConnectionException if the connection attempts fails or is |
| 92 | 94 | * refused by the server. |
| 93 | 95 | */ |
| 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 { | |
| 95 | 97 | this.address = address; |
| 96 | 98 | this.factory = factory; |
| 97 | 99 | this.name = name; |
| 100 | + this.poolRef.set(pool); | |
| 98 | 101 | |
| 99 | 102 | ClientBootstrap bootstrap = factory.newBootstrap(); |
| 100 | 103 | ProtocolOptions protocolOptions = factory.configuration.getProtocolOptions(); |
| @@ -126,12 +129,9 @@ | ||
| 126 | 129 | |
| 127 | 130 | /** |
| 128 | 131 | * 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)} | |
| 131 | 132 | */ |
| 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); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | private static String extractMessage(Throwable t) { |
modified driver-core/src/test/java/com/datastax/driver/core/ReconnectionTest.java +0 −1
| @@ -13,7 +13,6 @@ | ||
| 13 | 13 | |
| 14 | 14 | import com.google.common.base.Charsets; |
| 15 | 15 | import com.google.common.collect.ImmutableMap; |
| 16 | -import org.mockito.Mockito; | |
| 17 | 16 | import org.testng.annotations.Test; |
| 18 | 17 | |
| 19 | 18 | import static org.assertj.core.api.Assertions.assertThat; |