froehlich    02/01/29 11:39:54

  Modified:    src/java/org/apache/cocoon/components/store
                        MRUMemoryStore.java
  Log:
  Ok, for the Cache maniacs. When the Servlet engine is shutdown
  nice, then the current memory cache will be saved to the disk.
  So the old status is available at the next restart.
  
  Revision  Changes    Path
  1.5       +18 -0     
xml-cocoon2/src/java/org/apache/cocoon/components/store/MRUMemoryStore.java
  
  Index: MRUMemoryStore.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/store/MRUMemoryStore.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MRUMemoryStore.java       28 Jan 2002 19:57:52 -0000      1.4
  +++ MRUMemoryStore.java       29 Jan 2002 19:39:54 -0000      1.5
  @@ -130,9 +130,27 @@
        */
       public void dispose() {
           if (this.manager != null) {
  +            this.getLogger().debug("Disposing component!");          
               this.manager.release(this.storejanitor);
               this.storejanitor = null;
               this.manager.release(this.fsstore);
  +            
  +            //save all cache entries to filesystem
  +            this.getLogger().debug("Final cache size=" + this.cache.size());
  +            Enumeration enum = this.cache.keys();
  +            while(enum.hasMoreElements()) {
  +                Object tmp = enum.nextElement();
  +                try {
  +                    if(tmp != null 
  +                       && checkSerializable(this.cache.get(tmp))) {
  +                       this.fsstore.store(this.getFileName(tmp.toString()),
  +                                           this.cache.remove(tmp));
  +                    }
  +                } catch (IOException ioe) {
  +                    this.getLogger().error("Error in dispose():",ioe); 
  +                }
  +            }
  +            
               this.fsstore = null;
           }
       }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to