001/**
002 * Copyright (c) 2025-2026, Michael Yang 杨福海 (fuhai999@gmail.com).
003 * <p>
004 * Licensed under the GNU Lesser General Public License (LGPL) ,Version 3.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p>
008 * http://www.gnu.org/licenses/lgpl-3.0.txt
009 * <p>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package dev.tinyflow.core.chain.repository;
017
018/**
019 * 分布式锁句柄,用于确保锁的正确释放。
020 * 使用 try-with-resources 模式保证释放。
021 */
022public interface ChainLock extends AutoCloseable {
023    /**
024     * 锁是否成功获取(用于判断是否超时)
025     */
026    boolean isAcquired();
027
028    /**
029     * 释放锁(幂等)
030     */
031    @Override
032    void close();
033}