public class AdaptiveTimingStrategy extends Object implements TimingStrategy
TimingStrategy that pays attention to the current level of activity in the database, i.e.
the number of started transactions, in order to decide how long to wait before scheduling the next task.NEVER_RUN, UNKNOWN| Modifier and Type | Method and Description |
|---|---|
static AdaptiveTimingStrategy |
defaultConfiguration()
Create a new instance of this strategy with default configuration, which is:
delta = 100ms
default delay = 2s
minimum delay = 5ms
maximum delay = 10s
busy threshold = 100
maximum samples = 200
maximum time = 2s
|
boolean |
equals(Object o) |
int |
hashCode() |
void |
initialize(org.neo4j.graphdb.GraphDatabaseService database)
Initialize the timing strategy before it can be used.
|
long |
nextDelay(long lastTaskDuration)
Get the delay until the timer fires again.
|
AdaptiveTimingStrategy |
withBusyThreshold(int busyThreshold)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the given busy threshold. |
AdaptiveTimingStrategy |
withDefaultDelayMillis(long defaultDelay)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the specified default timer-driven
module scheduling delay. |
AdaptiveTimingStrategy |
withDelta(long delta)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the specified delta. |
AdaptiveTimingStrategy |
withMaximumDelayMillis(long maxDelay)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the specified maximum delay between
timer-driven module invocations. |
AdaptiveTimingStrategy |
withMaxSamples(int maxSamples)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the maximum number of samples. |
AdaptiveTimingStrategy |
withMaxTime(int maxTime)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the given maximum running average window time span. |
AdaptiveTimingStrategy |
withMinimumDelayMillis(long minDelay)
Returns a copy of this
AdaptiveTimingStrategy reconfigured to use the specified minimum delay between
timer-driven module invocations. |
public static AdaptiveTimingStrategy defaultConfiguration()
public AdaptiveTimingStrategy withDelta(long delta)
AdaptiveTimingStrategy reconfigured to use the specified delta.delta - The new delta in milliseconds.AdaptiveTimingStrategy.public AdaptiveTimingStrategy withDefaultDelayMillis(long defaultDelay)
AdaptiveTimingStrategy reconfigured to use the specified default timer-driven
module scheduling delay.defaultDelay - The new default scheduling delay in milliseconds.AdaptiveTimingStrategy.public AdaptiveTimingStrategy withMinimumDelayMillis(long minDelay)
AdaptiveTimingStrategy reconfigured to use the specified minimum delay between
timer-driven module invocations.minDelay - The new minimum delay between timer-driven module invocations.AdaptiveTimingStrategy.public AdaptiveTimingStrategy withMaximumDelayMillis(long maxDelay)
AdaptiveTimingStrategy reconfigured to use the specified maximum delay between
timer-driven module invocations.maxDelay - The new maximum delay between timer-driven module invocations.AdaptiveTimingStrategy.public AdaptiveTimingStrategy withBusyThreshold(int busyThreshold)
AdaptiveTimingStrategy reconfigured to use the given busy threshold.busyThreshold - The new busy threshold to use.AdaptiveTimingStrategy.public AdaptiveTimingStrategy withMaxSamples(int maxSamples)
AdaptiveTimingStrategy reconfigured to use the maximum number of samples.maxSamples - The new maximum number of samples to use.AdaptiveTimingStrategy.public AdaptiveTimingStrategy withMaxTime(int maxTime)
AdaptiveTimingStrategy reconfigured to use the given maximum running average window time span.maxTime - The new maximum time to use.AdaptiveTimingStrategy.public void initialize(org.neo4j.graphdb.GraphDatabaseService database)
initialize in interface TimingStrategydatabase - against which the runtime using this strategy runs.public long nextDelay(long lastTaskDuration)
nextDelay in interface TimingStrategylastTaskDuration - The total time it took to execute the last task in milliseconds. -1 if unknown.Copyright © 2013-2016–2018 Graph Aware Limited. All rights reserved.