package net.openhft.chronicle.queue;

import net.openhft.chronicle.core.threads.EventHandler;
import net.openhft.chronicle.core.threads.HandlerPriority;
import net.openhft.chronicle.core.threads.InvalidEventHandlerException;
import net.openhft.chronicle.queue.impl.single.Pretoucher;
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueue;
import org.jetbrains.annotations.NotNull;

public final class PretouchHandler implements EventHandler {
    private final Pretoucher pretoucher;

    public PretouchHandler(final SingleChronicleQueue queue) {
        this.pretoucher = new Pretoucher(queue);
    }

    @Override
    public boolean action() throws InvalidEventHandlerException {
        pretoucher.execute();
        return false;
    }

    @NotNull
    @Override
    public HandlerPriority priority() {
        return HandlerPriority.MONITOR;
    }

    public void shutdown() {
        pretoucher.shutdown();
    }
}
@@ -490,16 +490,46 @@
 toucher;
+%0A    private long lastRun = 0;
 %0A%0A    pu
@@ -733,29 +733,186 @@
     
-pretoucher.execute();
+long now = System.currentTimeMillis();%0A        // don't check too often.%0A        if (now %3E lastRun + 100) %7B%0A            pretoucher.execute();%0A            lastRun = now;%0A        %7D
 %0A   

Make the pretoucher touch further ahead for long delays on new chunks.