aboutsummaryrefslogtreecommitdiffstats
path: root/service-monitor/src/main/java/com/yahoo/vespa/service/executor/RunletExecutor.java
blob: 2f9b90c5c1807b736a753c6d4a81ba1b19b95051 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.service.executor;

import java.time.Duration;

/**
 * @author hakonhall
 */
public interface RunletExecutor extends AutoCloseable {
    /**
     * Execute the task periodically with a fixed delay.
     *
     * <p>If the execution is {@link Cancellable#cancel() cancelled}, the runlet is {@link Runlet#close() closed}
     * as soon as possible.
     */
    Cancellable scheduleWithFixedDelay(Runlet runlet, Duration delay);

    /** Shuts down and waits for all execution to wind down. */
    @Override
    void close();
}