Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart7.png 63% of files have more coverage
5   62   7   0.71
0   26   1.4   3.5
7     1  
2    
 
  NoLockFactory       Line # 30 2 3 100% 1.0
  NoLock       Line # 47 3 4 42.9% 0.42857143
 
  (3)
 
1    package org.apache.lucene.store;
2   
3    /**
4    * Copyright 2006 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    import java.io.IOException;
20   
21    /**
22    * Use this {@link LockFactory} to disable locking entirely.
23    * This LockFactory is used when you call {@link FSDirectory#setDisableLocks}.
24    * Only one instance of this lock is created. You should call {@link
25    * #getNoLockFactory()} to get the instance.
26    *
27    * @see LockFactory
28    */
29   
 
30    public class NoLockFactory extends LockFactory {
31   
32    // Single instance returned whenever makeLock is called.
33    private static NoLock singletonLock = new NoLock();
34    private static NoLockFactory singleton = new NoLockFactory();
35   
 
36  2 toggle public static NoLockFactory getNoLockFactory() {
37  2 return singleton;
38    }
39   
 
40  10 toggle public Lock makeLock(String lockName) {
41  10 return singletonLock;
42    }
43   
 
44  2 toggle public void clearAllLocks() {};
45    };
46   
 
47    class NoLock extends Lock {
 
48  10 toggle public boolean obtain() throws IOException {
49  10 return true;
50    }
51   
 
52  10 toggle public void release() {
53    }
54   
 
55  0 toggle public boolean isLocked() {
56  0 return false;
57    }
58   
 
59  0 toggle public String toString() {
60  0 return "NoLock";
61    }
62    }