File tree Expand file tree Collapse file tree
driver-core/src/main/java/com/datastax/driver/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515- [ improvement] Create values() function for Insert builder using List (JAVA-225)
1616- [ improvement] Warn when ReplicationStrategy encounters invalid
1717 replication factors (JAVA-702)
18+ - [ improvement] Add PoolingOptions method to set both core and max
19+ connections (JAVA-662).
1820
1921Merged from 2.0.10_fixes branch:
2022
Original file line number Diff line number Diff line change @@ -230,6 +230,30 @@ public synchronized PoolingOptions setMaxConnectionsPerHost(HostDistance distanc
230230 return this ;
231231 }
232232
233+ /**
234+ * Sets the core and maximum number of connections per host in one call.
235+ * <p>
236+ * This is a convenience method that is equivalent to calling {@link #setCoreConnectionsPerHost(HostDistance, int)}
237+ * and {@link #setMaxConnectionsPerHost(HostDistance, int)}.
238+ *
239+ * @param distance the {@code HostDistance} for which to set these threshold.
240+ * @param core the core number of connections.
241+ * @param max the max number of connections.
242+ * @return this {@code PoolingOptions}.
243+ *
244+ * @throws IllegalArgumentException if {@code distance == HostDistance.IGNORED},
245+ * or if {@code core} > {@code max}.
246+ */
247+ public synchronized PoolingOptions setConnectionsPerHost (HostDistance distance , int core , int max ) {
248+ if (distance == HostDistance .IGNORED )
249+ throw new IllegalArgumentException ("Cannot set connections per host for " + distance + " hosts" );
250+
251+ checkConnectionsPerHostOrder (core , max , distance );
252+ coreConnections [distance .ordinal ()] = core ;
253+ maxConnections [distance .ordinal ()] = max ;
254+ return this ;
255+ }
256+
233257 /**
234258 * Returns the timeout before an idle connection is removed.
235259 *
You can’t perform that action at this time.
0 commit comments