Package io.servicetalk.http.api
Class HttpExecutionStrategies
- java.lang.Object
-
- io.servicetalk.http.api.HttpExecutionStrategies
-
public final class HttpExecutionStrategies extends java.lang.ObjectA factory to create differentHttpExecutionStrategy.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpExecutionStrategies.BuilderA builder to build anHttpExecutionStrategy.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpExecutionStrategies.BuildercustomStrategyBuilder()AHttpExecutionStrategythat disables all offloads.static HttpExecutionStrategydefaultStrategy()The defaultHttpExecutionStrategy.static HttpExecutionStrategydefaultStrategy(Executor executor)The defaultHttpExecutionStrategyusing the passedExecutor.static HttpExecutionStrategydifference(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 HttpExecutionStrategynoOffloadsStrategy()AHttpExecutionStrategythat disables all offloads on the request-response path.
-
-
-
Method Detail
-
defaultStrategy
public static HttpExecutionStrategy defaultStrategy()
The defaultHttpExecutionStrategy.- Returns:
- Default
HttpExecutionStrategy.
-
defaultStrategy
public static HttpExecutionStrategy defaultStrategy(Executor executor)
The defaultHttpExecutionStrategyusing the passedExecutor.- Parameters:
executor-Executorto use.- Returns:
- Default
HttpExecutionStrategy.
-
noOffloadsStrategy
public static HttpExecutionStrategy noOffloadsStrategy()
AHttpExecutionStrategythat disables all offloads on the request-response path.The default offloading executor will still be used inside
ExecutionContextand for all places where it is referenced. To ensure that the default offloading executor is never used configure it withExecutors.immediate()executor explicitly:HttpExecutionStrategies.customStrategyBuilder().offloadNone().executor(immediate()).build()- Returns:
HttpExecutionStrategythat disables all request-response path offloads.
-
customStrategyBuilder
public static HttpExecutionStrategies.Builder customStrategyBuilder()
AHttpExecutionStrategythat disables all offloads.- Returns:
HttpExecutionStrategythat 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 + MetaIn the above call hierarchy, ifEntity 1uses this method to find theHttpExecutionStrategyto use for invokingEntity 2, the resultingHttpExecutionStrategywill only offload sending to the transport. However, ifEntity 2uses this method to find theHttpExecutionStrategyto use for invokingEntity 3, the resultingHttpExecutionStrategywill only offload receiving of metadata.Effectively, using this method will remove redundant offloading when more than one entities provide their own
HttpExecutionStrategy.- Parameters:
fallback-Executorused as fallback while invoking the strategies.left-HttpExecutionStrategywhich is already in effect.right-HttpExecutionStrategywhich is expected to be used.- Returns:
HttpExecutionStrategyif there are any differences between the two strategies.nullif the two strategies are the same.
-
-