Details
Description
int threadIndex = this.clientIndex.getAndIncrement(); for (int i=0; i<size; i++) { int index = (threadIndex + i) % size; conn = tmpConnections.get(index); if (conn != null && conn.isUsable()) { return conn; } }
The above code in ConnectionPool.java getConnection method throws java.lang.ArrayIndexOutOfBoundsException when clientIndex wraps to Integer.MIN_VALUE and makes router reject all requests. threadIndex should be reset to 0.
if (threadIndex < 0) { // Wrap around 0 to keep array lookup index positive this.clientIndex.set(0); threadIndex = this.clientIndex.getAndIncrement(); }