Author: toad
Date: 2007-02-21 16:53:07 +0000 (Wed, 21 Feb 2007)
New Revision: 11882

Modified:
   trunk/freenet/src/freenet/client/RealArchiveStoreItem.java
Log:
Cache size

Modified: trunk/freenet/src/freenet/client/RealArchiveStoreItem.java
===================================================================
--- trunk/freenet/src/freenet/client/RealArchiveStoreItem.java  2007-02-21 
11:57:47 UTC (rev 11881)
+++ trunk/freenet/src/freenet/client/RealArchiveStoreItem.java  2007-02-21 
16:53:07 UTC (rev 11882)
@@ -18,6 +18,7 @@
        private final File myFilename;
        private final PaddedEphemerallyEncryptedBucket bucket;
        private final FileBucket underBucket;
+       private final long spaceUsed;

        /**
         * Create an ArchiveStoreElement from a TempStoreElement.
@@ -35,7 +36,8 @@
                underBucket.dontDeleteOnFinalize();
                underBucket.setReadOnly();
                this.myFilename = underBucket.getFile();
-               this.manager.incrementSpace(spaceUsed());
+               spaceUsed = FileUtil.estimateUsage(myFilename, 
underBucket.size());
+               this.manager.incrementSpace(spaceUsed);
        }

        /**
@@ -55,8 +57,8 @@
        /**
         * Return the estimated space used by the data.
         */
-       synchronized long spaceUsed() {
-               return FileUtil.estimateUsage(myFilename, underBucket.size());
+       long spaceUsed() {
+               return spaceUsed;
        }

        void close() {


Reply via email to