Update of /cvsroot/freenet/freenet/src/freenet/diagnostics
In directory sc8-pr-cvs1:/tmp/cvs-serv25857/src/freenet/diagnostics
Modified Files:
Tag: stable
FileEventList.java
Log Message:
5029: Merge from unstable after months of work. MASSIVE changes.
Highlights:
* Next Generation Routing, massive related changes
* Major changes to handling of messages and connections (PeerHandler and related
changes)
* Even more non-blocking I/O
* Documentation improvements
* Lots of new diagnostics and config options
* Lots of bug fixes and performance tweaking
* Probably lots of new bugs too!
Index: FileEventList.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/FileEventList.java,v
retrieving revision 1.1.1.1.4.1
retrieving revision 1.1.1.1.4.1.2.1
diff -u -w -r1.1.1.1.4.1 -r1.1.1.1.4.1.2.1
--- FileEventList.java 14 Dec 2002 18:16:01 -0000 1.1.1.1.4.1
+++ FileEventList.java 28 Oct 2003 20:20:31 -0000 1.1.1.1.4.1.2.1
@@ -92,8 +92,9 @@
}
private boolean write(DoublyLinkedList ll, File f) {
+ DataOutputStream out = null;
try {
- DataOutputStream out = new
+ out = new
DataOutputStream(new
BufferedOutputStream(new
FileOutputStream(f)));
@@ -103,19 +104,25 @@
out.writeBoolean(e.hasMoreElements());
}
out.flush();
- out.close();
return true;
} catch (IOException e) {
Core.logger.log(this,
"Failed to write data to disk, not overwriting",
e, Core.logger.ERROR);
return false;
+ } finally {
+ if(out != null) {
+ try {
+ out.close();
+ } catch (Throwable t) {};
+ }
}
}
private DoublyLinkedList read(File f, RandomVar to) {
+ DataInputStream in = null;
try {
- DataInputStream in = new
+ in = new
DataInputStream(new
BufferedInputStream(new
FileInputStream(f)));
@@ -125,16 +132,19 @@
ll.push(to.readEvent(in));
} while (in.readBoolean());
- in.close();
return ll;
} catch (IOException e) {
Core.logger.log(this,
"Failed to read data from disk, using empty file.",
e, Core.logger.ERROR);
return new DoublyLinkedListImpl();
-
+ } finally {
+ if(in != null) {
+ try {
+ in.close();
+ } catch (Throwable t) {};
+ }
}
-
}
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs