# Interface HttpIOExceptionHandler (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpIOExceptionHandler)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.http.HttpIOExceptionHandler)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.http.HttpIOExceptionHandler)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.http.HttpIOExceptionHandler)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.http.HttpIOExceptionHandler)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.http.HttpIOExceptionHandler)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.http.HttpIOExceptionHandler)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.http.HttpIOExceptionHandler)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.http.HttpIOExceptionHandler)

    public interface HttpIOExceptionHandler

[Beta](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta)   

Handles an [IOException](https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html) in an HTTP request.

For example, this might be used to handle an [IOException](https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html) with [BackOff](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff) policy.

public static class HttpBackOffIOExceptionHandler implements HttpIOExceptionHandler {
BackOff backOff;
Sleeper sleeper;
public boolean handle(HttpRequest request, boolean supportsRetry) throws IOException {
if (!supportsRetry) {
return false;
}
try {
return BackOffUtils.next(sleeper, backOff);
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
return false;
}
}
}

## Methods

### handleIOException(HttpRequest request, boolean supportsRetry)

    public abstract boolean handleIOException(HttpRequest request, boolean supportsRetry)

Invoked when an [IOException](https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html) is thrown during an HTTP request.

There is a simple rule that one must follow: If you modify the request object or modify its
execute interceptors in a way that should resolve the error, you must return `true` to
issue a retry.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpRequest` request object that can be read from for context or modified before retry |
| `supportsRetry` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` whether there will actually be a retry if this handler return `true` . Some handlers may want to have an effect only when there will actually be a retry after they handle their event (e.g. a handler that implements backoff policy). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | whether or not this handler has made a change that will require the request to be re-sent. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |