File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
src/main/java/org/apache/commons/pool2/impl Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -212,16 +212,11 @@ public void addObject() throws Exception {
212212 if (factory == null ) {
213213 throw new IllegalStateException ("Cannot add objects without a factory." );
214214 }
215- synchronized (makeObjectCountLock ) {
216- final int localMaxTotal = getMaxTotal ();
217- final int localMaxIdle = getMaxIdle ();
218- if (localMaxIdle >= 0 && getNumIdle () >= localMaxIdle ) {
219- // Pool already has maxIdle idle objects or maxIdle is 0.
220- return ;
221- }
222- if (localMaxTotal < 0 || createCount .get () < localMaxTotal ) {
223- addIdleObject (create (getMaxWaitDuration ()));
224- }
215+ final int localMaxIdle = getMaxIdle ();
216+ final int localMaxTotal = getMaxTotal ();
217+ if ((localMaxIdle < 0 || getNumIdle () < localMaxIdle ) &&
218+ (localMaxTotal < 0 || createCount .get () < localMaxTotal )) {
219+ addIdleObject (create (getMaxWaitDuration ()));
225220 }
226221 }
227222
You can’t perform that action at this time.
0 commit comments