In Chronicle Queue, the time at which queues are rolled over is based on the UTC time; Chronicle Queue uses System.currentTimeMillis()
.
The Timezone Rollover Enterprise feature extends Chronicle Queue’s ability to specify the time and periodicity of queue rollovers, to take account of the user’s location timezone, rather than UTC.
Note
|
This feature is only relevant to daily rollovers where RollCycle is one of:
- SMALL_DAILY
- DAILY
- LARGE_DAILY
- XLARGE_DAILY
- HUGE_DAILY
|
public SingleChronicleQueueBuilder<E> rollTime(@NotNull final LocalTime rollTime, final ZoneId zoneId) {
this.cycleCalculator = new TimeZoneAwareCycleCalculator(zoneId);
this.epoch = TimeUnit.SECONDS.toMillis(rollTime.toSecondOfDay());
return this;
}
Note
|
rollTime() allows the rollover time of the cycle file to be controlled in both Chronicle Queue open-source and Chronicle QueueEnterprise Edition.If this is used with in the open-source version, any zoneId other than UTC will be converted to UTC , and a warning message logged.
|
The following code extract is an instruction to use Europe/London
as time zone, and rolls over queues at midnight regardless of offset to UTC.
.rollTime(LocalTime.of(0, 0), ZoneId.of("Europe/London"))
The following code extract is an instruction to use America/New_York
as time zone, and rolls over queues at midnight regardless of offset to UTC.
.rollTime(LocalTime.of(17, 0), ZoneId.of("America/New_York"))
To use this feature you must use the Chronicle distributed time provider, net.openhft.chronicle.core.time.SystemTimeProvider
.