Sylvain Wallez wrote:
> 
> Sebastien Koechlin a écrit :
> >
> > Here is a patch against cocoon_20_branch, I don't know if you can apply
> > it on HEAD (I did not test).
> >
> > Please, do NOT include it into cocoon_20_branch CVS on apache.org, it's
> > working, but eat huge quantity of memory, and displayed data are raw.
> > This is not for final administrators yet.
> 
> Applied to 2.1, thanks.
> I modified it a bit to output SAX events directly instead of building
> large lists.

Ok, I was not really proud of thoses lists.


> HEY, TEAM, can a cache guru look at this ? Why are there 3 stores with
> the same keys in them ?

First :

There is something wrong in my code, I have in logs:
DEBUG ... DefaultComponentFactory: ComponentFactory creating new
instance of org.apache.cocoon.generation.StatusGenerator.
DEBUG ... DefaultComponentFactory: no logger attribute available, using
standard logger
WARN  ... ExcaliburComponentManager: Looking up component on an
uninitialized ComponentManager:
org.apache.cocoon.components.store.StoreJanitor

So I probably do not have the main StoreJanitor.

I'm going to write a static (synchronized) StoreJanitor to 
record any in-memory Store created.
Is it a good solution, or is there something better ?


Second:

Everybody want to know what is inside, isn't it?
Here is another patch to display classname of cached object...

And surprise, there is nothing in our Stores!
When I request an Object by his key, I have nothing most of the
time!

Why does we store null values in MRUMemoryStores ?


Here is the StatusGenerator patch against HEAD.
And an HTML page with StatusGenerator result using
this patch.

-- 
Sébastien Koechlin - IVision - [EMAIL PROTECTED]
--- /home/skc/src/xml-cocoon2/src/org/apache/cocoon/generation/StatusGenerator.java    
 Thu Dec  6 14:13:47 2001
+++ StatusGenerator.java        Thu Dec  6 16:01:55 2001
@@ -181,27 +181,29 @@
         Iterator i = this.storejanitor.iterator();
         while( i.hasNext() ) {
             Store store = (Store) i.next();
-            startGroup(ch, store.getClass().getName()+" (hash = 
"+store.hashCode()+")" );
+            startGroup(ch, store.getClass().getName()+" (hash = 
+0x"+Integer.toHexString(store.hashCode())+")" );
             int size = 0;
             atts.addAttribute(namespace, "name", "name", "CDATA", "cached");
             ch.startElement(namespace, "value", "value", atts);
             // For each element in Store
             Enumeration e = store.keys();
-            List cachelist = new ArrayList();
+            atts.clear();
             while( e.hasMoreElements() ) {
                 size++;
-                atts.clear();
-
                 ch.startElement(namespace, "line", "line", atts);
                 
-                Object o = e.nextElement();
-                String value = 
-                        o.toString() + " (hash: " +
-                        o.hashCode() + " | class: " +
-                        o.getClass().getName() +
-                        ")" ;
+                Object key  = e.nextElement();
+                Object val  = store.get( key );
+                String line = null;
+                if( val == null ) {
+                    line = key.toString() + " (NULL)";
+               } else {
+                    line = key.toString() + " (class: " +
+                           val.getClass().getName() +
+                           ")" ;
+                };
 
-                ch.characters(value.toCharArray(), 0, value.length());
+                ch.characters(line.toCharArray(), 0, line.length());
                 ch.endElement(namespace, "line", "line");
 
             };

Attachment: status.html.zip
Description: Zip compressed data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to