Package com.jcabi.github.wire
Class RetryCarefulWire
java.lang.Object
com.jcabi.github.wire.RetryCarefulWire
- All Implemented Interfaces:
com.jcabi.http.Wire
Wire that waits if the number of remaining requests per hour is less than
a given threshold, and in the event of
IOException retries a few
times before giving up and rethrowing the exception.
Just a wrapper for a RetryWire that wraps a
CarefulWire that wraps the underlying wire.
You can use RetryCarefulWire with a
GitHub object:
GitHub github = new RtGitHub(
new RtGitHub().entry().through(RetryCarefulWire.class, 50)
);
- Since:
- 0.23
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.jcabi.http.Responsesend(com.jcabi.http.Request req, String home, String method, Collection<Map.Entry<String, String>> headers, InputStream content, int connect, int read)
-
Constructor Details
-
RetryCarefulWire
public RetryCarefulWire(com.jcabi.http.Wire wire, int threshold) Public ctor.- Parameters:
wire- Original wirethreshold- Threshold of number of remaining requests, below which requests are blocked until reset
-
-
Method Details
-
send
public com.jcabi.http.Response send(com.jcabi.http.Request req, String home, String method, Collection<Map.Entry<String, String>> headers, InputStream content, int connect, int read) throws IOException- Specified by:
sendin interfacecom.jcabi.http.Wire- Throws:
IOException
-