1 | /* |
2 | |
3 | Derby - Class org.apache.derby.impl.store.raw.xact.NoLocking |
4 | |
5 | Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.impl.store.raw.xact; |
22 | |
23 | import org.apache.derby.iapi.services.locks.Latch; |
24 | |
25 | import org.apache.derby.iapi.store.raw.LockingPolicy; |
26 | import org.apache.derby.iapi.store.raw.ContainerHandle; |
27 | import org.apache.derby.iapi.store.raw.RecordHandle; |
28 | import org.apache.derby.iapi.store.raw.Transaction; |
29 | |
30 | import org.apache.derby.iapi.error.StandardException; |
31 | |
32 | |
33 | /** |
34 | A locking policy that implements no locking. |
35 | |
36 | @see LockingPolicy |
37 | */ |
38 | class NoLocking implements LockingPolicy { |
39 | |
40 | protected NoLocking() { |
41 | } |
42 | |
43 | public boolean lockContainer( |
44 | Transaction t, |
45 | ContainerHandle container, |
46 | boolean waitForLock, |
47 | boolean forUpdate) |
48 | throws StandardException { |
49 | return true; |
50 | } |
51 | |
52 | public void unlockContainer( |
53 | Transaction t, |
54 | ContainerHandle container) |
55 | { |
56 | } |
57 | |
58 | public boolean lockRecordForRead( |
59 | Transaction t, |
60 | ContainerHandle container, |
61 | RecordHandle record, |
62 | boolean waitForLock, |
63 | boolean forUpdate) |
64 | throws StandardException |
65 | { |
66 | return true; |
67 | } |
68 | |
69 | public void lockRecordForRead( |
70 | Latch latch, |
71 | RecordHandle record, |
72 | boolean forUpdate) |
73 | throws StandardException |
74 | { |
75 | } |
76 | |
77 | public boolean zeroDurationLockRecordForWrite( |
78 | Transaction t, |
79 | RecordHandle record, |
80 | boolean lockForPreviousKey, |
81 | boolean waitForLock) |
82 | throws StandardException |
83 | { |
84 | return true; |
85 | } |
86 | |
87 | public boolean lockRecordForWrite( |
88 | Transaction t, |
89 | RecordHandle record, |
90 | boolean lockForInsert, |
91 | boolean waitForLock) |
92 | throws StandardException |
93 | { |
94 | return true; |
95 | } |
96 | |
97 | public void lockRecordForWrite( |
98 | Latch latch, |
99 | RecordHandle record) |
100 | throws StandardException |
101 | { |
102 | } |
103 | |
104 | public void unlockRecordAfterRead( |
105 | Transaction t, |
106 | ContainerHandle container, |
107 | RecordHandle record, |
108 | boolean forUpdate, |
109 | boolean row_qualified) |
110 | throws StandardException |
111 | { |
112 | } |
113 | |
114 | public int getMode() { |
115 | return LockingPolicy.MODE_NONE; |
116 | } |
117 | |
118 | } |