xref: /OpenGrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/ResourceLock.java (revision 4151dbf5c28985f406f4f07f1c40626ac31346b4)
1 /*
2  * This work is licensed under the Creative Commons Attribution-ShareAlike 4.0
3  * International License. To view a copy of this license, visit
4  * https://creativecommons.org/licenses/by-sa/4.0/ or send a letter to
5  * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
6  *
7  * Copyright (c) 2017, https://stackoverflow.com/users/7583219/skoskav
8  * Copyright (c) 2011, https://stackoverflow.com/questions/6965731/are-locks-autocloseable
9  * Portions Copyright (c) 2019, Chris Fraire <cfraire@me.com>.
10  *
11  * Used under CC 4 with modifications noted as follows as required by license:
12  * 2019-09-10 -- cfraire@me.com, solely Javadoc changes.
13  */
14 
15 package org.opengrok.indexer.util;
16 
17 import java.util.concurrent.locks.Lock;
18 
19 /**
20  * Represents an API for try-with-resources management of a {@link Lock}.
21  */
22 public interface ResourceLock extends AutoCloseable {
23 
24     /**
25      * Unlocking doesn't throw any checked exception.
26      */
27     @Override
close()28     void close();
29 }
30