001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
002 *
003 * Copyright © 2024 microBean™.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
006 * the License. You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
011 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
012 * specific language governing permissions and limitations under the License.
013 */
014package org.microbean.construct;
015
016/**
017 * An {@link AutoCloseable} extension whose {@link #close()} method throws no checked exceptions and unlocks something
018 * that may have been previously locked in some unspecified manner.
019 *
020 * @author <a href="https://about.m/lairdnelson" target="_top">Laird Nelson</a>
021 * 
022 * @see #close()
023 *
024 * @see AutoCloseable
025 */
026public interface Unlockable extends AutoCloseable {
027
028  /**
029   * Unlocks this {@link Unlockable}, which normally has been semantically locked already in some unspecified manner.
030   *
031   * <p>Implementations of this method must be idempotent.</p>
032   *
033   * @exception IllegalMonitorStateException if this {@link Unlockable} is implemented directly or indirectly by a
034   * {@link java.util.concurrent.locks.ReentrantLock} of some kind, and if that backing {@link
035   * java.util.concurrent.locks.ReentrantLock}'s {@link java.util.concurrent.locks.ReentrantLock#unlock() unlock()}
036   * method throws this exception
037   *
038   * @see java.util.concurrent.locks.ReentrantLock#unlock()
039   */
040  @Override
041  public void close();
042
043}