@Immutable public final class RetryWire extends Object implements Wire
This wire retries again (at least three times) if an original one throws
IOException
:
String html = new JdkRequest("http://goggle.com") .through(RetryWire.class) .header(HttpHeaders.ACCEPT, MediaType.TEXT_PLAIN) .fetch() .body();
The class is immutable and thread-safe.
public RetryWire(@NotNull(message="wire can\'t be NULL") Wire wire)
wire
- Original wire@RetryOnFailure(attempts=5, delay=1L, unit=SECONDS, verbose=false) public Response send(Request req, String home, String method, Collection<Map.Entry<String,String>> headers, byte[] content) throws IOException
send
in interface Wire
req
- Requesthome
- URI to fetchmethod
- HTTP methodheaders
- Headerscontent
- HTTP bodyIOException
- if failsCopyright © 2012–2014 jcabi.com. All rights reserved.