001/* 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 */ 006 007package org.fcrepo.kernel.api.lock; 008 009import org.fcrepo.kernel.api.exception.ConcurrentUpdateException; 010import org.fcrepo.kernel.api.identifiers.FedoraId; 011 012/** 013 * Responsible for managing write locks on Fedora resources 014 * 015 * @author pwinckles 016 */ 017public interface ResourceLockManager { 018 019 /** 020 * Acquires a lock on the resource, associating it to the txId. If the lock is held by a different transaction, 021 * an exception is thrown. If the lock is already held by the same transaction, then it returns successfully. 022 * 023 * @param txId the transaction id to associate the lock to 024 * @param resourceId the resource to lock 025 * @throws ConcurrentUpdateException when lock cannot be acquired 026 */ 027 void acquire(final String txId, final FedoraId resourceId); 028 029 /** 030 * Releases all of the locks held by the transaction 031 * 032 * @param txId the transaction id 033 */ 034 void releaseAll(final String txId); 035 036}