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

/**
 * A {@code Runlet} joins {@link AutoCloseable} with {@link Runnable} with the following semantics:
 *
 * <ul>
 *     <li>The {@link #run()} method may be called any number of times, followed by a single call to {@link #close()}.
 *     <li>The caller must ensure the calls are ordered by {@code happens-before}, i.e. the class can be thread-unsafe.
 * </ul>
 *
 * @author hakonhall
 */
public interface Runlet extends AutoCloseable, Runnable {
    void run();

    @Override
    void close();
}