[concurrency-interest] Fwd: ScheduledThreadPoolExecutor woes

Hanson Char hanson.char at gmail.com
Wed Feb 14 05:15:28 EST 2007


I see, but then this warning is related the RetryPolicies.java, not the
missing AbstractRetryPolicy.java that I added in.  I guess one way to get
rid of the warning is to use the signature Class<?> instead of Class<?
extends Exception>, and then throw an IllegalArgumentException if the actual
arguments turn out to be not subclasses of Exception.

Joshua, the original author of RetryPolicies.java, is probably the better
person to comment on this.

Hanson

On 2/13/07, Rémi Forax <forax at univ-mlv.fr> wrote:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070214/8d34cbcc/attachment.html 


More information about the Concurrency-interest mailing list