[concurrency-interest] Fwd: ScheduledThreadPoolExecutor woes

Rémi Forax forax at univ-mlv.fr
Wed Feb 14 02:50:48 EST 2007


Hanson Char a écrit :
>  >I think your code is not useable,
> 
> Not sure what you mean.  It's being used everywhere in RetryPolicies and 
> there is no warnings.

try to call exponentialBackoff, truncatedExponentialBackoff
or fixedDelay and you will see.

By example, for this code:
static void test(Class<? extends Exception>... cs) {

}

public static void main(String[] args) {
   test(RuntimeException.class); // is unsafe here
}

javac generates that output:
Foo.java:13: warning: [unchecked] unchecked generic array creation of 
type java.lang.Class<? extends java.lang.Exception>[] for varargs parameter
       test(RuntimeException.class);
           ^
1 warning


> 
> See:
> 
>     
> https://dev.priorartisans.com/repos/jcip/trunk/src/main/jcip/retry/RetryPolicies.java
> 
>  >How do you expect to use your constructor ?
> 
> See the RetryPolicies.java for usages.
> 
> A slight improvement on the AbstractRetryPolicy is to let the 
> constructor accept varargs.  See below.
> 
> Hanson

cheers,
Rémi



More information about the Concurrency-interest mailing list