[concurrency-interest] Fwd: ScheduledThreadPoolExecutor woes

Hanson Char hanson.char at gmail.com
Tue Feb 13 23:16:19 EST 2007


>I think your code is not useable,

Not sure what you mean.  It's being used everywhere in RetryPolicies and
there is no warnings.

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

package net.jcip.retry;

/**
 * @author Josh Bloch
 * @author Hanson Char - fill in the missing pieces
 */
// https://dev.priorartisans.com/repos/jcip/trunk/src/main/jcip/retry/
public abstract class AbstractRetryPolicy implements RetryPolicy
{
    private final Class<? extends Exception>[] recoverableExceptions;

    public AbstractRetryPolicy(Class<? extends Exception>...
recoverableExceptions)
    {
        this.recoverableExceptions = recoverableExceptions;
    }

    public abstract long nextDelay(long startTime, int retries);

    public boolean isFailureRecoverable(Exception e)
    {
        for (Class<? extends Exception> c : recoverableExceptions)
            if (c.isAssignableFrom(e.getClass()))
                return true;
        return false;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070213/4b38ee52/attachment.html 


More information about the Concurrency-interest mailing list