mirror of https://github.com/apache/lucene.git
- Renamed a variable to reflect its functionality and fixed indentation.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150132 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80071b33e3
commit
054d9a4029
|
@ -87,12 +87,12 @@ public final class RAMDirectory extends Directory {
|
||||||
* @exception IOException if an error occurs
|
* @exception IOException if an error occurs
|
||||||
*/
|
*/
|
||||||
public RAMDirectory(Directory dir) throws IOException {
|
public RAMDirectory(Directory dir) throws IOException {
|
||||||
final String[] ar = dir.list();
|
final String[] files = dir.list();
|
||||||
for (int i = 0; i < ar.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
// make place on ram disk
|
// make place on ram disk
|
||||||
OutputStream os = createFile(ar[i]);
|
OutputStream os = createFile(files[i]);
|
||||||
// read current file
|
// read current file
|
||||||
InputStream is = dir.openFile(ar[i]);
|
InputStream is = dir.openFile(files[i]);
|
||||||
// and copy to ram disk
|
// and copy to ram disk
|
||||||
int len = (int) is.length();
|
int len = (int) is.length();
|
||||||
byte[] buf = new byte[len];
|
byte[] buf = new byte[len];
|
||||||
|
@ -204,22 +204,22 @@ public final class RAMDirectory extends Directory {
|
||||||
*/
|
*/
|
||||||
public final Lock makeLock(final String name) {
|
public final Lock makeLock(final String name) {
|
||||||
return new Lock() {
|
return new Lock() {
|
||||||
public boolean obtain() throws IOException {
|
public boolean obtain() throws IOException {
|
||||||
synchronized (files) {
|
synchronized (files) {
|
||||||
if (!fileExists(name)) {
|
if (!fileExists(name)) {
|
||||||
createFile(name).close();
|
createFile(name).close();
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
public void release() {
|
}
|
||||||
deleteFile(name);
|
public void release() {
|
||||||
}
|
deleteFile(name);
|
||||||
public boolean isLocked() {
|
}
|
||||||
return fileExists(name);
|
public boolean isLocked() {
|
||||||
}
|
return fileExists(name);
|
||||||
};
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Closes the store to future operations. */
|
/** Closes the store to future operations. */
|
||||||
|
|
Loading…
Reference in New Issue