return false on executionexception

This commit is contained in:
Adrian Cole 2011-02-27 20:59:54 -08:00
parent 54ab2aa82b
commit 0e794c4788
1 changed files with 8 additions and 0 deletions

View File

@ -20,11 +20,13 @@
package org.jclouds.predicates;
import java.util.Date;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.jclouds.logging.Logger;
import org.jclouds.util.Throwables2;
import com.google.common.base.Predicate;
@ -72,6 +74,12 @@ public class RetryablePredicate<T> implements Predicate<T> {
}
} catch (InterruptedException e) {
logger.warn(e, "predicate %s on %s interrupted, returning false", input, predicate);
} catch (RuntimeException e) {
ExecutionException exec = Throwables2.getFirstThrowableOfType(e, ExecutionException.class);
if (exec != null)
logger.warn(exec, "predicate %s on %s error, returning false", input, predicate);
else
throw e;
}
return false;
}