Class LeastResponseTimeConfiguration
- java.lang.Object
-
- io.smallrye.stork.loadbalancer.leastresponsetime.LeastResponseTimeConfiguration
-
- All Implemented Interfaces:
ConfigWithType
public class LeastResponseTimeConfiguration extends Object implements ConfigWithType
Configuration for theLeastResponseTimeLoadBalancerProviderLoadBalancer.
-
-
Constructor Summary
Constructors Constructor Description LeastResponseTimeConfiguration()Creates a new LeastResponseTimeConfigurationLeastResponseTimeConfiguration(Map<String,String> params)Creates a new LeastResponseTimeConfiguration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDecliningFactor()How much *score* should decline in time, see Score calculation in the docs for details.StringgetErrorPenalty()This load balancer treats an erroneous response as a response after this time.StringgetUseSecureRandom()Whether the load balancer should use a SecureRandom instead of a Random (default).Map<String,String>parameters()Stringtype()LeastResponseTimeConfigurationwithDecliningFactor(String value)Set the 'declining-factor' attribute.LeastResponseTimeConfigurationwithErrorPenalty(String value)Set the 'error-penalty' attribute.LeastResponseTimeConfigurationwithUseSecureRandom(String value)Set the 'use-secure-random' attribute.
-
-
-
Constructor Detail
-
LeastResponseTimeConfiguration
public LeastResponseTimeConfiguration(Map<String,String> params)
Creates a new LeastResponseTimeConfiguration- Parameters:
params- the parameters, must not benull
-
LeastResponseTimeConfiguration
public LeastResponseTimeConfiguration()
Creates a new LeastResponseTimeConfiguration
-
-
Method Detail
-
type
public String type()
- Specified by:
typein interfaceConfigWithType- Returns:
- the type
-
parameters
public Map<String,String> parameters()
- Specified by:
parametersin interfaceConfigWithType- Returns:
- the parameters
-
getDecliningFactor
public String getDecliningFactor()
How much *score* should decline in time, see Score calculation in the docs for details. By default: 0.9- Returns:
- the configured declining-factor,
0.9if not set
-
withDecliningFactor
public LeastResponseTimeConfiguration withDecliningFactor(String value)
Set the 'declining-factor' attribute. Default is 0.9.- Parameters:
value- the value for declining-factor- Returns:
- the current LeastResponseTimeConfiguration to chain calls
-
getErrorPenalty
public String getErrorPenalty()
This load balancer treats an erroneous response as a response after this time. By default: 60s- Returns:
- the configured error-penalty,
60sif not set
-
withErrorPenalty
public LeastResponseTimeConfiguration withErrorPenalty(String value)
Set the 'error-penalty' attribute. Default is 60s.- Parameters:
value- the value for error-penalty- Returns:
- the current LeastResponseTimeConfiguration to chain calls
-
getUseSecureRandom
public String getUseSecureRandom()
Whether the load balancer should use a SecureRandom instead of a Random (default). Check [this page](https://stackoverflow.com/questions/11051205/difference-between-java-util-random-and-java-security-securerandom) to understand the difference By default: false- Returns:
- the configured use-secure-random,
falseif not set
-
withUseSecureRandom
public LeastResponseTimeConfiguration withUseSecureRandom(String value)
Set the 'use-secure-random' attribute. Default is false.- Parameters:
value- the value for use-secure-random- Returns:
- the current LeastResponseTimeConfiguration to chain calls
-
-