commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [commons-pool] Question on whenExhaustedAction setting ?
Date Mon, 12 Jan 2004 21:45:05 GMT
Actually, when a case is matched inside a switch statement then the 
code is executed until a break statement.

When you enter the switch statement (line 1) with WHEN_EXHAUSTED_FAIL 
there will be a jump to the case on line 3 and then the code will run 
to the break on line 7.

So for all valid values the code on line 5-6 will be executed.

-- Dirk


Radhakrishnan J wrote:
> I was referring to the below mentioned instance. The setter for
> whenExhaustedAction ignores the WHEN_EXHAUSTED_FAIL case.
> 
>     public synchronized void setWhenExhaustedAction(byte
> whenExhaustedAction) {
1>         switch(whenExhaustedAction) {
2>             case WHEN_EXHAUSTED_BLOCK:
3>             case WHEN_EXHAUSTED_FAIL:
4>             case WHEN_EXHAUSTED_GROW:
5>                 _whenExhaustedAction = whenExhaustedAction;
6>                 notifyAll();
7>                 break;
8>             default:
9>                 throw new 
IllegalArgumentException("whenExhaustedAction " +
> whenExhaustedAction + " not recognized.");
>         }
>     }
> 
> -Radhakrishnan



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message