📄 lock.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Core License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: Lock.java,v 1.10 2000/10/28 16:55:16 daniela Exp $package org.ozoneDB.core;import java.io.*;import org.ozoneDB.DxLib.*;import org.ozoneDB.*;/** * Locks are created by the {@link TransactionManager} and used by the core * to manage concurrent access to the same containers/objects. There are several * Lock implementations that provide different policies. * * * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.10 $Date: 2000/10/28 16:55:16 $ */public interface Lock extends Serializable { public final static int NOT_ACQUIRED = -1; public final static int LEVEL_NONE = 0; public final static int LEVEL_READ = 1; public final static int LEVEL_UPGRADE = 2; public final static int LEVEL_WRITE = 4; // levels >= this are not valid public final static int LEVEL_MAX = 5; public void reset(); /** * Check for deadlock and throw an exception if a deadlock is detected. * Although the transactions waits for locks and so seems also to be * be a good place for deadlock detection, we do it here because each * Lock implementations should hide the deadlock detection logic. */ public void checkDeadlock( Transaction ta ) throws Exception; /** * Try to aquire this lock. This method returns the previous level of the * specified transaction, if the lock was sucessfully acquired. Otherwise * it returns NOT_ACQUIRED. * * * @return The previous level for the given transaction or NOT_ACQUIRED. */ public int tryAcquire( Transaction ta, int level ); /** * Release the previously aquired lock. */ public void release( Transaction ta ); public boolean isAcquiredBy( Transaction ta ); /** * Return all transactions that currently hold this lock. */ public DxCollection lockerIDs(); /** * Returns the lock level for the specified transaction. If ta is null, * then we do not check ta against the transaction that has acquired this * lock. * * * @param ta The transaction that has acquired the lock or null. * @return Lock level for ta if ta has aquired the lock or ta is null. LEVEL_NONE * otherwise. */ public int level( Transaction ta ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -