You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by pe...@mindspring.com on 2001/10/25 22:40:15 UTC

Pull service session tools not returning to pool

Hi,

I've looked and looked, but can't figure out where if at all the Pull
Service will return a session tool to the pool service via putInstance() or
offer() of the Turbine  Pool service.

The most I can figure is that for session scope tools, the pool will grow
and grow with new instances and the old ones will never be returned. Maybe
I'm missing something...

Is this handled somewhere??

-Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Pull service session tools not returning to pool

Posted by Sean Legassick <se...@informage.net>.
In message <m3...@despot.finemaltcoding.com>, Daniel Rall 
<dl...@finemaltcoding.com> writes
>Don't be jealous of C!  Java can have memory leaks too.  ;-)

Which is of course true, hold on to a reference to an object beyond its 
useful lifespan and it will not be eligible for garbage collection...

However in this case note that the situation is currently no worse than 
not using the pool at all, a cursory examination of the PoolService code 
suggests that no reference to a pooled object is held by the pool after 
it is obtained by getInstance. So currently the session tools are 
subject to a normal instance creation/garbage collection lifetime.

It would obviously be preferable to have the instances returned to the 
pool after use for memory efficiency.

-- 
Sean Legassick
sean@informage.net
         As a person, nothing human can be alien to me

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pull service session tools not returning to pool

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Sean Legassick <se...@informage.net> writes:

> In message <Sp...@www.springmail.com>,
> peterlynch@mindspring.com writes
> >I've looked and looked, but can't figure out where if at all the Pull
>>Service will return a session tool to the pool service via putInstance() or
>>offer() of the Turbine  Pool service.
>>
>>The most I can figure is that for session scope tools, the pool will grow
>>and grow with new instances and the old ones will never be returned. Maybe
>>I'm missing something...
>
> No, you're absolutely correct. This is something I had meant to
> address at some point. The tool instance needs to be returned to the
> pool when the session is unbound, but there is nothing like
> HttpSessionBindingListener API for objects stored in the User
> hashtable. Hmm.

Don't be jealous of C!  Java can have memory leaks too.  ;-)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pull service session tools not returning to pool

Posted by Peter Lynch <pe...@mindspring.com>.
> No, you're absolutely correct. This is something I had meant to address
> at some point. The tool instance needs to be returned to the pool when
> the session is unbound, but there is nothing like
> HttpSessionBindingListener API for objects stored in the User hashtable.
> Hmm.

No? TurbineUser.java implements HttpSessionBindingListener though??

What I ended up doing is making a BaseTurbineUser.java that implements
User.java
Then added the code below to the valueUnbound method.
----------8<

        Enumeration elements = this.tempStorage.elements();

        while (elements.hasMoreElements())
        {
            Object obj = elements.nextElement();

            try
            {
                if (!TurbinePool.putInstance( obj ) )
                {
                     System.out.println("There was an error returning " +
obj + " to the TurbinePoolService.");
                }
            }
            catch (Exception e)
            {
                System.out.println("There was an error returning " + obj + "
to the TurbinePoolService.");

            }
        }

--------------8<


Then we have our own user type object extend the BaseTurbineUser class.
Seems to do the trick.
Of course I assume that everything in the temp user table is something I
want to return to the pool, which in my case is safe to do.

-Peter



>
> --
> Sean Legassick
> sean@informage.net
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pull service session tools not returning to pool

Posted by Sean Legassick <se...@informage.net>.
In message <Sp...@www.springmail.com>, 
peterlynch@mindspring.com writes
>I've looked and looked, but can't figure out where if at all the Pull
>Service will return a session tool to the pool service via putInstance() or
>offer() of the Turbine  Pool service.
>
>The most I can figure is that for session scope tools, the pool will grow
>and grow with new instances and the old ones will never be returned. Maybe
>I'm missing something...

No, you're absolutely correct. This is something I had meant to address 
at some point. The tool instance needs to be returned to the pool when 
the session is unbound, but there is nothing like 
HttpSessionBindingListener API for objects stored in the User hashtable. 
Hmm.

-- 
Sean Legassick
sean@informage.net

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>