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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StaticDelayGeneratorStaticDelayGeneratorinstance with zero 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 TypeMethodDescriptionlongGenerate a new delay value on initial request.longGenerate a new delay value on a retried request.toString()
-
Field Details
-
ZERO_DELAY_GENERATOR
StaticDelayGeneratorinstance with zero delay.
-
-
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.TheshouldImmediatelyFeedbackmethod has been removed from the interface so theimmediatelyFeedbackparameter 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_NSshould 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:
generateDelayNsin 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:
retryDelayNsin interfaceFeedbackDelayGenerator- Returns:
- delay value in nanoseconds
-
toString
-
shouldImmediatelyFeedbackmethod has been removed from the interface so theimmediatelyFeedbackparameter is ignored.