Package io.servicetalk.http.api
Class HttpExecutionStrategies
java.lang.Object
io.servicetalk.http.api.HttpExecutionStrategies
A factory to create different
HttpExecutionStrategy
.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionA Builder for creating customHttpExecutionStrategy
.static HttpExecutionStrategy
A special defaultHttpExecutionStrategy
that provides safe default offloading of actions; the offloading used is unspecified and dependent upon the usage situation.static HttpExecutionStrategy
difference
(HttpExecutionStrategy left, HttpExecutionStrategy right) Find the difference between two strategies and provide a resulting strategy if there are differences in between the strategies.static HttpExecutionStrategy
AnHttpExecutionStrategy
that requires full offloading of the request-response path and transport events.static HttpExecutionStrategy
Deprecated.static HttpExecutionStrategy
AnHttpExecutionStrategy
that requires no offloads on the request-response path or transport event path.
-
Method Details
-
defaultStrategy
A special defaultHttpExecutionStrategy
that provides safe default offloading of actions; the offloading used is unspecified and dependent upon the usage situation. It may not be merged with other strategies because the resulting strategy would lose the defaulting behavior. As an additional safety measure all offload query methods will return true.- Returns:
- Default
HttpExecutionStrategy
.
-
offloadNever
Deprecated.UseoffloadNone()
instead.A specialHttpExecutionStrategy
that disables all offloads on the request-response and transport event paths. This strategy is intended to be used only for client and server builders; it should not be returned byHttpExecutionStrategyInfluencer.requiredOffloads()
, which should returnoffloadNone()
instead. When merged with another execution strategy the result is always this strategy.- Returns:
HttpExecutionStrategy
that disables all request-response path offloads.- See Also:
-
offloadNone
AnHttpExecutionStrategy
that requires no offloads on the request-response path or transport event path. ForHttpExecutionStrategyInfluencer
s that do not block, theHttpExecutionStrategyInfluencer.requiredOffloads()
method should return this value. UnlikeoffloadNever()
, this strategy merges normally with other execution strategy instances.- Returns:
HttpExecutionStrategy
that requires no request-response path offloads.- See Also:
-
offloadAll
AnHttpExecutionStrategy
that requires full offloading of the request-response path and transport events. UnlikedefaultStrategy()
, this strategy merges normally with other execution strategy instances.- Returns:
HttpExecutionStrategy
that requires no request-response path offloads.- See Also:
-
customStrategyBuilder
A Builder for creating customHttpExecutionStrategy
.- Returns:
- a builder for custom
HttpExecutionStrategy
.
-
difference
@Nullable public static HttpExecutionStrategy difference(HttpExecutionStrategy left, HttpExecutionStrategy right) Find the difference between two strategies and provide a resulting strategy if there are differences in between the strategies. The resulting strategy can then be used to offload the difference between two strategies. This is typically used if there is a call hierarchy and each entity in the hierarchy defines its ownHttpExecutionStrategy
. This method is useful to reduce duplicating work across these entities if the caller has already offloaded all the paths required to be offloaded by the callee.Entities: Entity 1 ⇒ Entity 2 ⇒ Entity 3 (calls) (calls) Strategies: No offloads Offload Send Offload Send + Meta
In the above call hierarchy, ifEntity 1
uses this method to find theHttpExecutionStrategy
to use for invokingEntity 2
, the resultingHttpExecutionStrategy
will only offload sending to the transport. However, ifEntity 2
uses this method to find theHttpExecutionStrategy
to use for invokingEntity 3
, the resultingHttpExecutionStrategy
will only offload receiving of metadata.Effectively, using this method will remove redundant offloading when more than one entity each provide their own
HttpExecutionStrategy
.- Parameters:
left
-HttpExecutionStrategy
which is already in effect.right
-HttpExecutionStrategy
which is expected to be used.- Returns:
HttpExecutionStrategy
if there are any differences between the two strategies.null
if the two strategies are the same.
-
offloadNone()
instead.