Update of /cvsroot/freenet/freenet/src/freenet/fs/dir
In directory sc8-pr-cvs1:/tmp/cvs-serv29253/src/freenet/fs/dir
Modified Files:
NativeFSDirectory.java
Log Message:
6234:
* Limit the volume of queryrejects sent to a node due to version being too old.
Includes exponential backoff.
* Dump low priority messages (e.g. most QueryRejected's) if we don't have a free conn
(reinstates pre-PH behaviour - bugfix).
* If a node is not contactable, and no free connections, discard the message.
* Bugfixes in PacketMessage.jobDone relating to losing message sent notifications.
* New diagnostics: messageSendTimeContactable, messageSendTimeNonContactable. Not all
old ones restored yet.
* Make sure we close files in FileEventList
* Add count of total files open by NativeFSDir to interesting objects dump.
* Indenting, logging
Index: NativeFSDirectory.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/fs/dir/NativeFSDirectory.java,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -r1.161 -r1.162
--- NativeFSDirectory.java 7 Oct 2003 00:47:30 -0000 1.161
+++ NativeFSDirectory.java 11 Oct 2003 20:00:18 -0000 1.162
@@ -1667,7 +1667,16 @@
outsSyncs[x] = new Object();
}
}
-
+
+ public int totalOpenFiles() {
+ synchronized(totalOpenFilesSync) {
+ return totalOpenFiles;
+ }
+ }
+
+ Object totalOpenFilesSync = new Object();
+ int totalOpenFiles = 0;
+
class NativeBuffer implements Buffer, Comparable {
FileNumber fn;
byte status = 0;
@@ -1886,6 +1895,9 @@
if(status == FAILED) throw new DirectoryException
("Trying to open failed buffer"+fn);
if(raf == null) {
+ synchronized(totalOpenFilesSync) {
+ totalOpenFiles++;
+ }
rafPos = -1;
raf = new RandomAccessFile(getFile(), "rw");
}
@@ -1928,6 +1940,9 @@
rafPos = -1;
raf.getFD().sync();
raf.close();
+
synchronized(totalOpenFilesSync) {
+
totalOpenFiles--;
+ }
raf = null;
} catch (IOException e) {
if (Core.logger.shouldLog(Core.logger.ERROR))
@@ -2194,8 +2209,12 @@
boolean b = (raf != null);
rafPos = -1;
try {
- if(b)
+ if(b) {
+
synchronized(totalOpenFilesSync) {
+
totalOpenFiles--;
+ }
raf.close();
+ }
raf = null;
} catch (IOException e) {
Core.logger.log(this, "IOException while closing in "
@@ -2206,7 +2225,6 @@
finally {
raf = null;
}
- raf = null;
if(status != ALMOSTCOMMITTED)
throw new DirectoryException("reallyCommit() called on
file "+
"not ALMOSTCOMMITTED");
@@ -2225,12 +2243,17 @@
DirectoryException("finalizing rename failed");
}
try {
- if(b)
+ if(b) {
raf = new RandomAccessFile(g, "rw");
+
synchronized(totalOpenFilesSync) {
+
totalOpenFiles++;
+ }
+ }
} catch (IOException e) {
Core.logger.log(this, "IOException reopening"+
" file in commit()", e,
Core.logger.NORMAL);
+ raf = null;
throw new DirectoryException
("IOException reopening file in commit()");
}
@@ -2310,7 +2333,12 @@
touch();
synchronized(rafSync) {
rafPos = -1;
- if(raf != null) raf.close();
+ if(raf != null) {
+ synchronized(totalOpenFilesSync) {
+ totalOpenFiles--;
+ }
+ raf.close();
+ }
File f = getFile();
tempRand = Core.randSource.nextLong();
File g = getTempFile(fn, tempRand);
@@ -2341,7 +2369,10 @@
tempSpaceUsed += x;
}
}
- raf = new RandomAccessFile(g, "rw");
+ raf = new RandomAccessFile(g, "rw");
+ synchronized(totalOpenFilesSync) {
+ totalOpenFiles++;
+ }
}
}
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs