Annotation Type Timeout
Overrides the connect/read timeout, taking priority over both the shared
client's configured default and a
RipClientConfig's
timeout - for one endpoint whose expected latency doesn't match the rest
of the client (a report-export endpoint that's expected to be slow, a
health check that should fail fast).
@GET("/reports/export")
@Timeout(readMillis = 120_000)
String exportReport();
Also valid directly on a @RestClient interface, as a default for
every method that doesn't declare its own - mirroring @BaseUrl's
own interface-level-default/per-method-override shape, for an interface
that wants one uniform timeout instead of repeating the same annotation
on every method:
@RestClient
@Timeout(readMillis = 5_000)
interface FlakyDownstreamApi {
@GET("/status")
String getStatus(); // uses the interface's 5s read timeout
@GET("/reports/export")
@Timeout(readMillis = 120_000)
String exportReport(); // overrides it with its own
}
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionintThe connect timeout in milliseconds, or-1(the default) to leave the connect timeout at whatever it would otherwise be.intThe read (socket) timeout in milliseconds, or-1(the default) to leave the read timeout at whatever it would otherwise be.
-
Element Details
-
connectMillis
int connectMillisThe connect timeout in milliseconds, or-1(the default) to leave the connect timeout at whatever it would otherwise be.- Returns:
- the connect timeout in milliseconds, or
-1if unset
- Default:
- -1
-
readMillis
int readMillisThe read (socket) timeout in milliseconds, or-1(the default) to leave the read timeout at whatever it would otherwise be.- Returns:
- the read timeout in milliseconds, or
-1if unset
- Default:
- -1
-