Package io.servicetalk.http.api
Class HttpExecutionStrategies
- java.lang.Object
-
- io.servicetalk.http.api.HttpExecutionStrategies
-
public final class HttpExecutionStrategies extends java.lang.Object
A factory to create differentHttpExecutionStrategy
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpExecutionStrategies.Builder
A builder to build anHttpExecutionStrategy
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpExecutionStrategies.Builder
customStrategyBuilder()
AHttpExecutionStrategy
that disables all offloads.static HttpExecutionStrategy
defaultStrategy()
The defaultHttpExecutionStrategy
.static HttpExecutionStrategy
defaultStrategy(Executor executor)
The defaultHttpExecutionStrategy
using the passedExecutor
.static HttpExecutionStrategy
difference(Executor fallback, 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
noOffloadsStrategy()
AHttpExecutionStrategy
that disables all offloads.
-
-
-
Method Detail
-
defaultStrategy
public static HttpExecutionStrategy defaultStrategy()
The defaultHttpExecutionStrategy
.- Returns:
- Default
HttpExecutionStrategy
.
-
defaultStrategy
public static HttpExecutionStrategy defaultStrategy(Executor executor)
The defaultHttpExecutionStrategy
using the passedExecutor
.- Parameters:
executor
-Executor
to use.- Returns:
- Default
HttpExecutionStrategy
.
-
noOffloadsStrategy
public static HttpExecutionStrategy noOffloadsStrategy()
AHttpExecutionStrategy
that disables all offloads.- Returns:
HttpExecutionStrategy
that disables all offloads.
-
customStrategyBuilder
public static HttpExecutionStrategies.Builder customStrategyBuilder()
AHttpExecutionStrategy
that disables all offloads.- Returns:
HttpExecutionStrategy
that disables all offloads.
-
difference
@Nullable public static HttpExecutionStrategy difference(Executor fallback, 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 entities provide their own
HttpExecutionStrategy
.- Parameters:
fallback
-Executor
used as fallback while invoking the strategies.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.
-
-