public class DelayedRenewableTimeoutService extends org.neo4j.kernel.lifecycle.LifecycleAdapter implements Runnable, RenewableTimeoutService
RenewableTimeoutService. It uses a scheduled thread
pool to check for timeouts and as such has a limited resolution of TIMER_RESOLUTION, measured in
TIMER_RESOLUTION_UNIT. For the same reason, the timeouts are triggered at an approximate delay rather than
exactly at the value requested.
RenewableTimeoutService.TimeoutHandler are all called from the same thread,
so users should be aware to not perform time consuming tasks in them.RenewableTimeoutService.RenewableTimeout, RenewableTimeoutService.TimeoutHandler, RenewableTimeoutService.TimeoutName| Constructor and Description |
|---|
DelayedRenewableTimeoutService(Clock clock,
org.neo4j.logging.LogProvider logProvider) |
| Modifier and Type | Method and Description |
|---|---|
RenewableTimeoutService.RenewableTimeout |
create(RenewableTimeoutService.TimeoutName name,
long delayInMillis,
long randomRangeInMillis,
RenewableTimeoutService.TimeoutHandler handler)
Set up a new timeout.
|
void |
init() |
void |
run() |
void |
start() |
void |
stop() |
public DelayedRenewableTimeoutService(Clock clock, org.neo4j.logging.LogProvider logProvider)
public RenewableTimeoutService.RenewableTimeout create(RenewableTimeoutService.TimeoutName name, long delayInMillis, long randomRangeInMillis, RenewableTimeoutService.TimeoutHandler handler)
The randomRangeInMillis attribute allows you to introduce a bit of arbitrariness in when the timeout is triggered, which is a useful way to avoid "thundering herds" when multiple timeouts are likely to trigger at the same time.
If you don't want randomness, set randomRangeInMillis to 0.
create in interface RenewableTimeoutServicename - The timeout name, for lookup purposesdelayInMillis - The amount of time after this timeout will be triggeredrandomRangeInMillis - The upper limit of a range of longs (0 is the lower limit) from which a random value will be
selected with uniform probability, and added to the delay. Setting this value to 0 means
no randomness.handler - The RenewableTimeoutService.TimeoutHandler to call when this timeout triggerspublic void init()
init in interface org.neo4j.kernel.lifecycle.Lifecycleinit in class org.neo4j.kernel.lifecycle.LifecycleAdapterpublic void start()
start in interface org.neo4j.kernel.lifecycle.Lifecyclestart in class org.neo4j.kernel.lifecycle.LifecycleAdapterpublic void stop()
stop in interface org.neo4j.kernel.lifecycle.Lifecyclestop in class org.neo4j.kernel.lifecycle.LifecycleAdapterCopyright © 2002–2016 The Neo4j Graph Database Project. All rights reserved.