I suppose if this is true, it could be a huge benefit to Tomcat 3.X since it
seems to use the SimplePool class in a few critical sections of code such as
JspFactoryImpl, AdapterHandler, and PoolTCPEndpoint. Tomcat 4.X only uses it in
the JspFactoryImpl. I am assuming that my analysis is flawed since lack of
pooling on these objects would have shown up quite some time ago, but here
goes...

in org.apache.tomcat.util.SimplePool...

member variable
============
private int current=-1;

put method (insert item into pool)
========================
public void put(Object o) {
    int idx=-1;
    synchronized( lock ) {
        if( current < max )
            idx=++current;
    }

    if( idx > 0 ) pool[idx]=o;  // <-- here
}

It seems that the check "here" should be (idx >= 0) in order for any object to
be inserted into the pool.

jim


Reply via email to