mirror of https://github.com/apache/lucene.git
Added a method used in test cases to determine if a file descriptor is
closed. Added troubleshooting code (commented out) to help diagnose problems around openning and closing files. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
250f13e99c
commit
4e84ddc3f5
|
@ -381,10 +381,34 @@ public final class FSDirectory extends Directory {
|
||||||
|
|
||||||
final class FSInputStream extends InputStream {
|
final class FSInputStream extends InputStream {
|
||||||
private class Descriptor extends RandomAccessFile {
|
private class Descriptor extends RandomAccessFile {
|
||||||
|
/* DEBUG */
|
||||||
|
//private String name;
|
||||||
|
/* DEBUG */
|
||||||
public long position;
|
public long position;
|
||||||
public Descriptor(File file, String mode) throws IOException {
|
public Descriptor(File file, String mode) throws IOException {
|
||||||
super(file, mode);
|
super(file, mode);
|
||||||
|
/* DEBUG */
|
||||||
|
//name = file.toString();
|
||||||
|
//debug_printInfo("OPEN");
|
||||||
|
/* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DEBUG */
|
||||||
|
//public void close() throws IOException {
|
||||||
|
// debug_printInfo("CLOSE");
|
||||||
|
// super.close();
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//private void debug_printInfo(String op) {
|
||||||
|
// try { throw new Exception(op + " <" + name + ">");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// java.io.StringWriter sw = new java.io.StringWriter();
|
||||||
|
// java.io.PrintWriter pw = new java.io.PrintWriter(sw);
|
||||||
|
// e.printStackTrace(pw);
|
||||||
|
// System.out.println(sw.getBuffer().toString());
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
/* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
Descriptor file = null;
|
Descriptor file = null;
|
||||||
|
@ -433,6 +457,13 @@ final class FSInputStream extends InputStream {
|
||||||
clone.isClone = true;
|
clone.isClone = true;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Method used for testing. Returns true if the underlying
|
||||||
|
* file descriptor is valid.
|
||||||
|
*/
|
||||||
|
boolean isFDValid() throws IOException {
|
||||||
|
return file.getFD().valid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue