1 /* 2 * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//transaction/src/java/org/apache/commons/transaction/locking/LockManager.java,v 1.4 2005/01/07 13:32:33 ozeigermann Exp $ 3 <<<<<<< .mine 4 * $Revision: 1.4 $ 5 * $Date: 2005-02-26 14:16:14 +0100 (Sa, 26 Feb 2005) $ 6 ======= 7 * $Revision$ 8 * $Date: 2005-02-26 14:16:14 +0100 (Sa, 26 Feb 2005) $ 9 >>>>>>> .r168169 10 * 11 * ==================================================================== 12 * 13 * Copyright 1999-2004 The Apache Software Foundation 14 * 15 * Licensed under the Apache License, Version 2.0 (the "License"); 16 * you may not use this file except in compliance with the License. 17 * You may obtain a copy of the License at 18 * 19 * http://www.apache.org/licenses/LICENSE-2.0 20 * 21 * Unless required by applicable law or agreed to in writing, software 22 * distributed under the License is distributed on an "AS IS" BASIS, 23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 * See the License for the specific language governing permissions and 25 * limitations under the License. 26 * 27 */ 28 29 package org.apache.commons.transaction.locking; 30 31 /** 32 * 33 * A manager for multi level locks on resources. Encapsulates creation, removal, and retrieval of locks. 34 * Each resource can have at most a single lock. However, it may be possible for more than one 35 * accessing entity to have influence on this lock via different lock levels that may be 36 * provided by the according implementation of {@link MultiLevelLock}. 37 * 38 * @version $Revision$ 39 * @see MultiLevelLock 40 */ 41 public interface LockManager { 42 43 /** 44 * Either gets an existing lock on the specified resource or creates one if none exists. 45 * This methods guarantees to do this atomically. 46 * 47 * @param resourceId the resource to get or create the lock on 48 * @return the lock for the specified resource 49 */ 50 public MultiLevelLock atomicGetOrCreateLock(Object resourceId); 51 52 /** 53 * Gets an existing lock on the specified resource. If none exists it returns <code>null</code>. 54 * 55 * @param resourceId the resource to get the lock for 56 * @return the lock on the specified resource 57 */ 58 public MultiLevelLock getLock(Object resourceId); 59 60 /** 61 * Removes the specified lock from the associated resource. 62 * 63 * @param lock the lock to be removed 64 */ 65 public void removeLock(MultiLevelLock lock); 66 } 67