KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > odmg > locking > LockStrategy


1 package org.apache.ojb.odmg.locking;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import org.apache.ojb.odmg.TransactionImpl;
19
20 /**
21  * this interface defines method that a Locking Strategy must implement
22  * according to the transaction isolation level it represents.
23  * @deprecated
24  */

25 public interface LockStrategy
26 {
27
28     /**
29      * acquire a read lock on Object obj for Transaction tx.
30      * @param tx the transaction requesting the lock
31      * @param obj the Object to be locked
32      * @return true if successful, else false
33      *
34      */

35     public boolean readLock(TransactionImpl tx, Object JavaDoc obj);
36
37     /**
38      * acquire a write lock on Object obj for Transaction tx.
39      * @param tx the transaction requesting the lock
40      * @param obj the Object to be locked
41      * @return true if successful, else false
42      *
43      */

44     public boolean writeLock(TransactionImpl tx, Object JavaDoc obj);
45
46     /**
47      * acquire a lock upgrade (from read to write) lock on Object obj for Transaction tx.
48      * @param tx the transaction requesting the lock
49      * @param obj the Object to be locked
50      * @return true if successful, else false
51      *
52      */

53     public boolean upgradeLock(TransactionImpl tx, Object JavaDoc obj);
54
55     /**
56      * release a lock on Object obj for Transaction tx.
57      * @param tx the transaction releasing the lock
58      * @param obj the Object to be unlocked
59      * @return true if successful, else false
60      *
61      */

62     public boolean releaseLock(TransactionImpl tx, Object JavaDoc obj);
63
64     /**
65      * checks whether the specified Object obj is read-locked by Transaction tx.
66      * @param tx the transaction
67      * @param obj the Object to be checked
68      * @return true if lock exists, else false
69      */

70     public boolean checkRead(TransactionImpl tx, Object JavaDoc obj);
71
72     /**
73      * checks whether the specified Object obj is write-locked by Transaction tx.
74      * @param tx the transaction
75      * @param obj the Object to be checked
76      * @return true if lock exists, else false
77      */

78     public boolean checkWrite(TransactionImpl tx, Object JavaDoc obj);
79 }
80
Popular Tags