Package org.kiwiproject.retry
Class KiwiRetryerPredicates
- java.lang.Object
-
- org.kiwiproject.retry.KiwiRetryerPredicates
-
public class KiwiRetryerPredicates extends Object
Some potentially useful predicates that can be used out of the box withKiwiRetryeror directly withRetryerBuilder, or anything else that accepts a GuavaPredicate.Note that the Jakarta RS-API needs to be available at runtime to use the
Responsepredicates.- Implementation Note:
- These use Guava's and not the JDK's predicate class, because the guava-retrying library used in
KiwiRetryeruses Guava'sPredicate.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.base.Predicate<Throwable>CONNECTION_ERRORCheck if a givenThrowableis or has a root cause ofConnectException.static com.google.common.base.Predicate<javax.ws.rs.core.Response>IS_HTTP_400sCheck if a given JAX-RSResponseis a client error (4xx).static com.google.common.base.Predicate<javax.ws.rs.core.Response>IS_HTTP_500sCheck if a given JAX-RSResponseis a client error (4xx).static com.google.common.base.Predicate<Throwable>NO_ROUTE_TO_HOSTCheck if a givenThrowableis or has a root cause ofNoRouteToHostException.static com.google.common.base.Predicate<Throwable>SOCKET_TIMEOUTCheck if a givenThrowableis or has a root cause ofSocketTimeoutException.static com.google.common.base.Predicate<Throwable>SSL_HANDSHAKE_ERRORCheck if a givenThrowableis or contains aSSLHandshakeExceptionsomewhere in the causal chain.static com.google.common.base.Predicate<Throwable>UNKNOWN_HOSTCheck if a givenThrowableis or has a root cause ofUnknownHostException.
-
Constructor Summary
Constructors Constructor Description KiwiRetryerPredicates()
-
-
-
Field Detail
-
UNKNOWN_HOST
public static final com.google.common.base.Predicate<Throwable> UNKNOWN_HOST
Check if a givenThrowableis or has a root cause ofUnknownHostException.- Implementation Note:
- UnknownHostException does not have a cause, which is why we check only the instance and root cause
-
CONNECTION_ERROR
public static final com.google.common.base.Predicate<Throwable> CONNECTION_ERROR
Check if a givenThrowableis or has a root cause ofConnectException.- Implementation Note:
- ConnectException does not have a cause, which is why we check only the instance and root cause
-
SOCKET_TIMEOUT
public static final com.google.common.base.Predicate<Throwable> SOCKET_TIMEOUT
Check if a givenThrowableis or has a root cause ofSocketTimeoutException.- Implementation Note:
- SocketTimeoutException does not have a cause, which is why we check only the instance and root cause
-
SSL_HANDSHAKE_ERROR
public static final com.google.common.base.Predicate<Throwable> SSL_HANDSHAKE_ERROR
Check if a givenThrowableis or contains aSSLHandshakeExceptionsomewhere in the causal chain.
-
NO_ROUTE_TO_HOST
public static final com.google.common.base.Predicate<Throwable> NO_ROUTE_TO_HOST
Check if a givenThrowableis or has a root cause ofNoRouteToHostException.- Implementation Note:
- NoRouteToHostException does not have a cause, which is why we check only the instance and root cause
-
IS_HTTP_400s
public static final com.google.common.base.Predicate<javax.ws.rs.core.Response> IS_HTTP_400s
Check if a given JAX-RSResponseis a client error (4xx).
-
IS_HTTP_500s
public static final com.google.common.base.Predicate<javax.ws.rs.core.Response> IS_HTTP_500s
Check if a given JAX-RSResponseis a client error (4xx).
-
-