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

/**
 * Represents a region of execution, e.g. the block of a try-with-resources.
 *
 * @author hakonhall
 */
@FunctionalInterface
public interface CriticalRegion extends AutoCloseable {
    /**
     * Ends the critical region.
     *
     * @throws IllegalStateException if the current thread is different from the one that started
     *         the critical region.
     */
    @Override void close() throws IllegalStateException;
}