Class ErrorsPerIntervalWithBlacklistTimeStrategy
java.lang.Object
org.distributeme.core.routing.blacklisting.intervalbased.withblacklistingtimeout.ErrorsPerIntervalWithBlacklistTimeStrategy
- All Implemented Interfaces:
BlacklistingStrategy
public class ErrorsPerIntervalWithBlacklistTimeStrategy
extends Object
implements BlacklistingStrategy
A service instance is blacklisted after x successive intervals of length y, in which
z failures occur. The blacklisting condition is fullfilled as soon as the error count is reached within
the current interval.
After blacklisting b seconds the service instance is going to be whitelisted again. During b no further
error checks are done. After whitelisting, the error detection starts again.
b=20, x=2, y=10, z=1
0-----4------10-------16-----20------------30------36-----40(Seconds)->
^ ^ ^
| |----------------------------|
Error Error -> Blacklisted Whitelisted again
b, x, y and z are configurable via configureme.
b: blacklistTime
x: requiredNumberOfIntervalsWithErrors
y: intervalDurationInSeconds
z: errorsPerIntervalThreshold
If no valid configuration is given, then getDecision() always returns false.- Author:
- rboehling
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisBlacklisted(String instanceId) Returns the blacklist decision for given service instanceID.voidnotifyCallFailed(ClientSideCallContext clientSideCallContext) Called by the router when a call to service instance failed.voidsetConfiguration(GenericRouterConfiguration configuration) Called by the router upon configuration change.
-
Constructor Details
-
ErrorsPerIntervalWithBlacklistTimeStrategy
public ErrorsPerIntervalWithBlacklistTimeStrategy()
-
-
Method Details
-
isBlacklisted
Description copied from interface:BlacklistingStrategyReturns the blacklist decision for given service instanceID.- Specified by:
isBlacklistedin interfaceBlacklistingStrategy
-
notifyCallFailed
Description copied from interface:BlacklistingStrategyCalled by the router when a call to service instance failed.- Specified by:
notifyCallFailedin interfaceBlacklistingStrategy- Parameters:
clientSideCallContext-
-
setConfiguration
Description copied from interface:BlacklistingStrategyCalled by the router upon configuration change.- Specified by:
setConfigurationin interfaceBlacklistingStrategy- Parameters:
configuration-
-