All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.taboola.async_profiler.utils.RecurringRunnable Maven / Gradle / Ivy

package com.taboola.async_profiler.utils;

import lombok.Getter;

@Getter
public class RecurringRunnable implements Runnable {

    private final Runnable baseRunnable;
    private volatile boolean isCancelled;

    public RecurringRunnable(Runnable baseRunnable) {
        this.baseRunnable = baseRunnable;
        this.isCancelled = false;
    }

    @Override
    public void run() {
        while (!isCancelled) {
            baseRunnable.run();
        }
    }

    public void cancel() {
        isCancelled = true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy