aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationLock.java
blob: 3043ec146a60501391e3ce15cb5275689006253a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.routing.rotation;

import com.yahoo.transaction.Mutex;
import com.yahoo.vespa.curator.Lock;

import java.util.Objects;

/**
 * A lock for the rotation repository. This is a type-safe wrapper for a curator lock.
 *
 * @author mpolden
 */
public class RotationLock implements AutoCloseable {

    private final Mutex lock;

    RotationLock(Mutex lock) {
        this.lock = Objects.requireNonNull(lock, "lock cannot be null");
    }

    @Override
    public void close() {
        lock.close();
    }
}