Author: toad
Date: 2009-02-04 13:40:22 +0000 (Wed, 04 Feb 2009)
New Revision: 25538

Modified:
   branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
Log:
Debugging


Modified: 
branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java  
2009-02-04 11:55:38 UTC (rev 25537)
+++ branches/db4o/freenet/src/freenet/support/io/PersistentBlobTempBucket.java  
2009-02-04 13:40:22 UTC (rev 25538)
@@ -69,13 +69,22 @@
                return persisted;
        }
        
+       private int inputStreams;
+       
        public InputStream getInputStream() throws IOException {
                if(freed) throw new IOException("Already freed");
                final FileChannel channel = factory.channel;
                return new InputStream() {
 
                        private int offset;
+                       private boolean closed;
                        
+                       {
+                               synchronized(PersistentBlobTempBucket.this) {
+                                       inputStreams++;
+                               }
+                       }
+                       
                        @Override
                        public int read() throws IOException {
                                byte[] buf = new byte[1];
@@ -113,6 +122,9 @@
                        }
                        
                        public void close() {
+                               synchronized(PersistentBlobTempBucket.this) {
+                                       inputStreams--;
+                               }
                                // Do nothing.
                        }
                        
@@ -212,6 +224,14 @@
                
        }
        
+       public boolean objectCanDeactivate(ObjectContainer container) {
+               if(inputStreams > 0) {
+                       Logger.error(this, "Deactivating when have active input 
streams!", new Exception("error"));
+                       return false;
+               }
+               return true;
+       }
+       
        public void removeFrom(ObjectContainer container) {
                if(shadow) throw new UnsupportedOperationException("Can't store 
a shadow");
                boolean p;

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to