Fix broken constructor chaining for FixedChannelPool class.

Motivation:

Only one of the three FixedChannelPool constructors checks for the constructor
arguments. Therfore it was possible to create a pool with zero maxConnections.

This change chains all constructors together, so that the last one
in the chain always checks the validity of the arguments, regardless of the
constructor used.

Result:

It is no longer possible to create a FixedChannelPool instance with invalid
maxConnections or maxPendingAcquires parameters.
This commit is contained in:
a-mkarjalainen 2015-06-18 11:48:20 +01:00 committed by Norman Maurer
parent ae3d2f9144
commit 33b37e350c

View File

@ -96,12 +96,7 @@ public final class FixedChannelPool extends SimpleChannelPool {
*/ */
public FixedChannelPool(Bootstrap bootstrap, public FixedChannelPool(Bootstrap bootstrap,
ChannelPoolHandler handler, int maxConnections, int maxPendingAcquires) { ChannelPoolHandler handler, int maxConnections, int maxPendingAcquires) {
super(bootstrap, handler); this(bootstrap, handler, ChannelHealthChecker.ACTIVE, null, -1, maxConnections, maxPendingAcquires);
executor = bootstrap.group().next();
timeoutTask = null;
acquireTimeoutNanos = -1;
this.maxConnections = maxConnections;
this.maxPendingAcquires = maxPendingAcquires;
} }
/** /**