Package io.aeron.driver
Class StaticDelayGenerator
java.lang.Object
io.aeron.driver.StaticDelayGenerator
- All Implemented Interfaces:
FeedbackDelayGenerator
Delay generator that simply returns a constant value for the delay and the retry delay.
-
Constructor Summary
ConstructorsConstructorDescriptionStaticDelayGenerator
(long delayNs) Create a delayInNs generator that uses the specified delayNs for both initial and retry delays.StaticDelayGenerator
(long delayNs, boolean immediateFeedback) Deprecated.StaticDelayGenerator
(long delayNs, long retryDelayNs) Create a delayInNs generator that uses the specified delayNs. -
Method Summary
Modifier and TypeMethodDescriptionlong
Generate a new delay value on initial request.long
Generate a new delay value on a retried request.toString()
-
Constructor Details
-
StaticDelayGenerator
public StaticDelayGenerator(long delayNs, long retryDelayNs) Create a delayInNs generator that uses the specified delayNs.- Parameters:
delayNs
- initial delay (nanoseconds)retryDelayNs
- delay for retry (nanoseconds)
-
StaticDelayGenerator
public StaticDelayGenerator(long delayNs) Create a delayInNs generator that uses the specified delayNs for both initial and retry delays.- Parameters:
delayNs
- delay (nanoseconds)
-
StaticDelayGenerator
Deprecated.TheshouldImmediatelyFeedback
method has been removed from the interface so theimmediatelyFeedback
parameter is ignored. You can emulate the old behaviour with:new StaticDelayGenerator(0, MILLISECONDS.toNanos(10));
If used for unicast delays, then this is not recommended and a short delay like the defaultConfiguration.NAK_UNICAST_DELAY_DEFAULT_NS
should be used.Deprecated constructor.- Parameters:
delayNs
- delay (nanoseconds)immediateFeedback
- immediately feedback (unused)
-
-
Method Details
-
generateDelayNs
public long generateDelayNs()Generate a new delay value on initial request.- Specified by:
generateDelayNs
in interfaceFeedbackDelayGenerator
- Returns:
- delay value in nanoseconds
-
retryDelayNs
public long retryDelayNs()Generate a new delay value on a retried request. Implementing this call is optional and will default toFeedbackDelayGenerator.generateDelayNs()
.- Specified by:
retryDelayNs
in interfaceFeedbackDelayGenerator
- Returns:
- delay value in nanoseconds
-
toString
-
shouldImmediatelyFeedback
method has been removed from the interface so theimmediatelyFeedback
parameter is ignored.