Update of /cvsroot/freenet/freenet/src/freenet/support
In directory sc8-pr-cvs1:/tmp/cvs-serv14016/src/freenet/support
Modified Files:
TempBucketFactory.java SimpleDataObjectStore.java
TempFileBucket.java
Log Message:
6290: don't show the request box either when in simple mode.
Index: TempBucketFactory.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/support/TempBucketFactory.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- TempBucketFactory.java 30 Oct 2003 01:34:01 -0000 1.11
+++ TempBucketFactory.java 31 Oct 2003 19:21:22 -0000 1.12
@@ -38,15 +38,15 @@
if(tmpDir == null) tmpDir = System.getProperty("java.io.tmpdir");
// Core.logger.log(this, "Creating TempBucketFactory, tmpDir = "+
// (tmpDir == null ? "(null)" : tmpDir),
-// new Exception("debug"), Core.logger.DEBUG);
+// new Exception("debug"), Logger.DEBUG);
}
public TempBucketFactory() {
this(System.getProperty("java.io.tmpdir"));
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Creating TempBucketFactory, tmpDir = "+
(tmpDir == null ? "(null)" : tmpDir),
- new Exception("debug"), Core.logger.DEBUG);
+ new Exception("debug"), Logger.DEBUG);
}
public Bucket makeBucket(long size) throws IOException {
@@ -73,23 +73,23 @@
f = new File(tmpDir, "tbf_" +
Long.toHexString(Math.abs(Core.getRandSource().nextInt())));
Core.logger.log(this, "Temp file in "+tmpDir,
- Core.logger.DEBUG);
+ Logger.DEBUG);
} else {
f = new File("tbf_" +
Long.toHexString(Math.abs(Core.getRandSource().nextInt())));
Core.logger.log(this, "Temp file in pwd",
- Core.logger.DEBUG);
+ Logger.DEBUG);
}
} while (f.exists());
//System.err.println("TEMP BUCKET CREATED: " + f.getAbsolutePath());
//(new Exception("creating TempBucket")).printStackTrace();
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Temp bucket created: " + f.getAbsolutePath()+
" with hook "+hook+" initial length "+size,
new Exception("creating TempBucket"),
- Core.logger.DEBUG);
+ Logger.DEBUG);
return new TempFileBucket(f, hook, size, increment, factor);
}
@@ -103,14 +103,14 @@
*/
public void freeBucket(Bucket b) throws IOException {
if (b instanceof TempFileBucket) {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Temp bucket released: " +
((TempFileBucket)b).getFile().getAbsolutePath(),
new Exception("debug"), Logger.DEBUG);
if(!((TempFileBucket) b).release()) {
System.err.println("Could not release temp bucket"+b);
Core.logger.log(this, "Could not release temp bucket "+b,
- Core.logger.ERROR);
+ Logger.ERROR);
}
}
}
@@ -123,16 +123,16 @@
**/
public static void setHook(TempBucketHook t) {
Core.logger.log(TempBucketFactory.class, "Set TempBucketHook to "+t,
- Core.logger.DEBUG);
+ Logger.DEBUG);
hook = t;
if (hook == null) {
// Allow hooks to be disabled w/o sprinkling
// if (hook != null) {/*blah blah */} calls
// throughout the code.
hook = DONT_HOOK;
- if(Core.logger.shouldLog(Core.logger.DEBUG)) {
+ if(Core.logger.shouldLog(Logger.DEBUG)) {
Core.logger.log(TempBucketHook.class, "TempBucketHook file usage
management was disabled.",
- Core.logger.DEBUG);
+ Logger.DEBUG);
}
}
}
Index: SimpleDataObjectStore.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/support/SimpleDataObjectStore.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -r1.16 -r1.17
--- SimpleDataObjectStore.java 30 Oct 2003 01:34:01 -0000 1.16
+++ SimpleDataObjectStore.java 31 Oct 2003 19:21:22 -0000 1.17
@@ -75,7 +75,7 @@
int isize = in.readInt();
Core.logger.log(this, "Preloading "+isize+" entries.",
- Core.logger.DEBUG);
+ Logger.DEBUG);
for (int i = 0 ; i < isize ; i++) {
try {
@@ -87,7 +87,7 @@
}
size++;
} catch (EOFException e) {
- Core.logger.log(this, "Size was wrong reading in
SimpleDataObjectStore", Core.logger.ERROR);
+ Core.logger.log(this, "Size was wrong reading in
SimpleDataObjectStore", Logger.ERROR);
truncated = true;
break;
}
@@ -123,7 +123,7 @@
*/
public void flush() throws IOException {
Core.logger.log(this, "Trying to write to "+targets[saveFile].
- getAbsolutePath(), Core.logger.DEBUG);
+ getAbsolutePath(), Logger.DEBUG);
FileOutputStream fo = new FileOutputStream(targets[saveFile]);
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(fo));
@@ -161,19 +161,19 @@
throws DataObjectUnloadedException {
long startTime = System.currentTimeMillis();
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Entering get("+key+") at "+startTime,
- Core.logger.DEBUG);
- long findsAtStart = contents.findCalled();
+ Logger.DEBUG);
+ long findsAtStart = Skiplist.findCalled();
DOWrapper res = (DOWrapper) contents.treeSearch(key);
- long findsAtEnd = contents.findCalled();
+ long findsAtEnd = Skiplist.findCalled();
long gotTime = System.currentTimeMillis();
long len = gotTime - startTime;
- if(len>500 || Core.logger.shouldLog(Core.logger.DEBUG))
+ if(len>500 || Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Ran treeSearch for "+key+" in "+len+
", find() called
"+(findsAtEnd-findsAtStart),
-
len>500?Core.logger.MINOR:Core.logger.DEBUG);
+
len>500?Logger.MINOR:Logger.DEBUG);
if (res == null)
return null;
Index: TempFileBucket.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/support/TempFileBucket.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -w -r1.18 -r1.19
--- TempFileBucket.java 30 Oct 2003 01:34:01 -0000 1.18
+++ TempFileBucket.java 31 Oct 2003 19:21:22 -0000 1.19
@@ -50,9 +50,9 @@
long x = startLength <= 0 ? minAlloc : startLength;
hook.createFile(x);
this.fakeLength = x;
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Initializing TempFileBucket("+f+","+
- hook+")", Core.logger.DEBUG);
+ hook+")", Logger.DEBUG);
}
/**
@@ -65,9 +65,9 @@
if(released)
throw new IllegalStateException("Trying to getInputStream on "+
"released TempFileBucket!");
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "getRealInputStream() for "+
- file, new Exception("debug"), Core.logger.DEBUG);
+ file, new Exception("debug"), Logger.DEBUG);
if(!file.exists()) return new NullInputStream();
else return new HookedFileBucketInputStream(file);
}
@@ -79,10 +79,10 @@
* @exception IOException Description of the Exception
*/
OutputStream getRealOutputStream() throws IOException {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "getRealOutputStream() for "+file,
new Exception("debug"),
- Core.logger.DEBUG);
+ Logger.DEBUG);
return super.getOutputStream();
}
@@ -96,9 +96,9 @@
* @exception IOException Description of the Exception
*/
public synchronized InputStream getInputStream() throws IOException {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "getInputStream for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
InputStream newIn = new SpyInputStream(this, file.getAbsolutePath());
return newIn;
}
@@ -110,17 +110,17 @@
* @exception IOException Description of the Exception
*/
public synchronized OutputStream getOutputStream() throws IOException {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "getOutputStream for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
return new SpyOutputStream(this, file.getAbsolutePath());
}
/** Description of the Method */
public synchronized void resetWrite() {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Resetting write for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
if (isReleased()) {
throw new RuntimeException("Attempt to use a released TempFileBucket: " +
getName());
@@ -142,10 +142,10 @@
// Force all open streams closed.
// Windows won't let us delete the file unless we
// do this.
- boolean shouldLog = Core.logger.shouldLog(Core.logger.DEBUG);
+ boolean shouldLog = Core.logger.shouldLog(Logger.DEBUG);
if(shouldLog)
Core.logger.log(this, "Releasing TempFileBucket "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
for (int i = 0; i < streams.size(); i++) {
try {
if (streams.elementAt(i) instanceof InputStream) {
@@ -178,12 +178,12 @@
} catch (IOException ioe) {
}
}
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Closed streams for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
if(released) {
Core.logger.log(this, "Already released file: "+file.getName(),
- Core.logger.MINOR);
+ Logger.MINOR);
if(file.exists())
throw new IllegalStateException("already released file "+
file.getName()+
@@ -192,7 +192,7 @@
}
if(shouldLog)
Core.logger.log(this, "Checked for released for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
released = true;
if (file.exists()) {
if(shouldLog)
@@ -210,7 +210,7 @@
}
if(shouldLog)
Core.logger.log(this, "release() returning true for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
return true;
}
@@ -229,9 +229,9 @@
* @exception Throwable Description of the Exception
*/
public void finalize() throws Throwable {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Finalizing TempFileBucket for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
super.finalize();
}
@@ -241,25 +241,25 @@
protected FileBucketOutputStream
newFileBucketOutputStream(String s, boolean append,
long restartCount) throws IOException {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Creating new HookedFileBucketOutputStream for "+
- file, Core.logger.DEBUG);
+ file, Logger.DEBUG);
if(hook != null)
return new HookedFileBucketOutputStream(s, append, restartCount);
else return super.newFileBucketOutputStream(s, append, restartCount);
}
protected void deleteFile() {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
- Core.logger.log(this, "Deleting "+file, Core.logger.DEBUG);
+ if(Core.logger.shouldLog(Logger.DEBUG))
+ Core.logger.log(this, "Deleting "+file, Logger.DEBUG);
file.delete();
if(hook != null) hook.deleteFile(fakeLength);
}
protected synchronized void resetLength() {
- if(Core.logger.shouldLog(Core.logger.DEBUG))
+ if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "Resetting length for "+file,
- Core.logger.DEBUG);
+ Logger.DEBUG);
if(length != 0) {
if(hook != null) {
hook.shrinkFile(0, fakeLength);
@@ -324,26 +324,26 @@
public void write(byte[] b) throws IOException {
// Core.logger.log(this, "HookedFileBucketOutputStream.write(byte[] len "+
-// b.length+") for "+file, Core.logger.DEBUG);
+// b.length+") for "+file, Logger.DEBUG);
synchronized(TempFileBucket.this) {
// Core.logger.log(this, "Synchronized on TempFileBucket",
-// Core.logger.DEBUG);
+// Logger.DEBUG);
super.confirmWriteSynchronized();
-// Core.logger.log(this, "confirmWriteSynchronized()", Core.logger.DEBUG);
+// Core.logger.log(this, "confirmWriteSynchronized()", Logger.DEBUG);
long finalLength = length + b.length;
// Core.logger.log(this, "length="+length+", finalLength="+finalLength,
-// Core.logger.DEBUG);
+// Logger.DEBUG);
long realStartLen = fakeLength;
getLengthSynchronized(finalLength);
-// Core.logger.log(this, "Called hook.enlargeFile()", Core.logger.DEBUG);
+// Core.logger.log(this, "Called hook.enlargeFile()", Logger.DEBUG);
try {
super.write(b);
-// Core.logger.log(this, "Written", Core.logger.DEBUG);
+// Core.logger.log(this, "Written", Logger.DEBUG);
} catch (IOException e) {
-// Core.logger.log(this, "Write failed", Core.logger.DEBUG);
+// Core.logger.log(this, "Write failed", Logger.DEBUG);
hook.shrinkFile(realStartLen, fakeLength);
fakeLength = realStartLen;
-// Core.logger.log(this, "Shrank file", Core.logger.DEBUG);
+// Core.logger.log(this, "Shrank file", Logger.DEBUG);
throw e;
}
}
@@ -351,7 +351,7 @@
public void write(byte[] b, int off, int len) throws IOException {
// Core.logger.log(this, "HookedFileBucketOutputStream.write(byte[], "+off+
-// ","+len+") for "+file, Core.logger.DEBUG);
+// ","+len+") for "+file, Logger.DEBUG);
synchronized(TempFileBucket.this) {
long finalLength = length + len;
long realStartLen = fakeLength;
@@ -368,7 +368,7 @@
public void write(int b) throws IOException {
// Core.logger.log(this, "HookedFileBucketOutputStream.write(int) for "+file,
-// Core.logger.DEBUG);
+// Logger.DEBUG);
synchronized(TempFileBucket.this) {
long finalLength = length + 1;
long realStartLen = fakeLength;
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs