You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jan Luehe <Ja...@Sun.COM> on 2003/10/15 18:16:27 UTC

[5.0] No sessions purged in Context with backgroundProcessorDelay > 0?

I may be totally wrong here, but it seems that if the
backgroundProcessorDelay property on a StandardContext is set to
something greater than zero (default is -1, inherited from
ContainerBase), the context's sessions are never purged.

This is because in ContainerBase$ContainerBackgroundProcessor,
processChildren() is implemented as follows:

     for (int i = 0; i < children.length; i++) {
         if (children[i].getBackgroundProcessorDelay() <= 0) {
             processChildren(children[i], cl);
         }
     }

So when invoked from the ContainerBackgroundProcessor of a
StandardHost, only the sessions of those StandardContexts with a
backgroundProcessorDelay <=0 will get purged.

I think the assumption is that if a StandardContext has a
backgroundProcessorDelay > 0, it would have its own
ContainerBackgroundProcessor spawn at startup. However, unlike
StandardEngine/Host/Wrapper, StandardContext.start() does not invoke
super.start(), and therefore a ContainerBackgroundProcessor is never
created for a StandardContext.

Am I missing something here?

Thanks,

Jan





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


Re: [5.0] No sessions purged in Context with backgroundProcessorDelay > 0?

Posted by Jan Luehe <Ja...@Sun.COM>.
Thanks for confirming, Remy!

I'll make these changes.

Jan

Remy Maucherat wrote:
> Jan Luehe wrote:
> 
>> I may be totally wrong here, but it seems that if the
>> backgroundProcessorDelay property on a StandardContext is set to
>> something greater than zero (default is -1, inherited from
>> ContainerBase), the context's sessions are never purged.
>>
>> This is because in ContainerBase$ContainerBackgroundProcessor,
>> processChildren() is implemented as follows:
>>
>>     for (int i = 0; i < children.length; i++) {
>>         if (children[i].getBackgroundProcessorDelay() <= 0) {
>>             processChildren(children[i], cl);
>>         }
>>     }
>>
>> So when invoked from the ContainerBackgroundProcessor of a
>> StandardHost, only the sessions of those StandardContexts with a
>> backgroundProcessorDelay <=0 will get purged.
>>
>> I think the assumption is that if a StandardContext has a
>> backgroundProcessorDelay > 0, it would have its own
>> ContainerBackgroundProcessor spawn at startup. However, unlike
>> StandardEngine/Host/Wrapper, StandardContext.start() does not invoke
>> super.start(), and therefore a ContainerBackgroundProcessor is never
>> created for a StandardContext.
> 
> 
> Arg, stupid me, I forgot about that. We need to add the code which 
> starts the backgroud thread in StandardContext.start.
> So we need to call super.startThread() and super.stopThread. This 
> doesn't seem too hard.
> 
> Remy
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 



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


Re: [5.0] No sessions purged in Context with backgroundProcessorDelay > 0?

Posted by Remy Maucherat <re...@apache.org>.
Jan Luehe wrote:

> I may be totally wrong here, but it seems that if the
> backgroundProcessorDelay property on a StandardContext is set to
> something greater than zero (default is -1, inherited from
> ContainerBase), the context's sessions are never purged.
> 
> This is because in ContainerBase$ContainerBackgroundProcessor,
> processChildren() is implemented as follows:
> 
>     for (int i = 0; i < children.length; i++) {
>         if (children[i].getBackgroundProcessorDelay() <= 0) {
>             processChildren(children[i], cl);
>         }
>     }
> 
> So when invoked from the ContainerBackgroundProcessor of a
> StandardHost, only the sessions of those StandardContexts with a
> backgroundProcessorDelay <=0 will get purged.
> 
> I think the assumption is that if a StandardContext has a
> backgroundProcessorDelay > 0, it would have its own
> ContainerBackgroundProcessor spawn at startup. However, unlike
> StandardEngine/Host/Wrapper, StandardContext.start() does not invoke
> super.start(), and therefore a ContainerBackgroundProcessor is never
> created for a StandardContext.

Arg, stupid me, I forgot about that. We need to add the code which 
starts the backgroud thread in StandardContext.start.
So we need to call super.startThread() and super.stopThread. This 
doesn't seem too hard.

Remy



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