You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kent Tong <ke...@cpttm.org.mo> on 2007/03/01 03:08:31 UTC

Re: reload on demand

Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:

> personally I don't see a very high value of it.
> If I remember correctly, a different approach has already been 
> implemented using one more layer of classloaders.
> you'd need to search around or someone might jump in and let you know 
> where it is.

Is that classloader included in Tomcat?




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


Re: reload on demand

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Yoav Shapira wrote:
> Hi,
>
> On 3/1/07, Kent Tong <ke...@cpttm.org.mo> wrote:
>> Christophe Pierret <cpierret <at> sparus-software.com> writes:
>>
>> > Then you can create a dirty.txt file that you add as a 
>> WatchedRessource.
>> > When you are ready to run, "touch" it and it will reload 
>> automatically.
>>
>> But then it takes an extra manual step, ie, touching the dirty.txt file,
>> before accessing the webapp.
>
> There will always be at least one manual step, because as things stand
> right now a computer program can't read your mind ;)  You don't want
> it to reload automatically when a specific resource (or resources)
> is/are modified, you don't want it to reload automatically on a time
> basis, you don't want to use the Manager HTML reload interface or the
> Ant tasks that invoke it in a script... What automatic options remain?
>
that's what I've been telling you dudes, this has already been solved
http://sourceforge.net/projects/tomcat-res-mgr/

I believe that is exactly what you want,
Filip

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


Re: Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Bill Barker <wbarker <at> wilshire.com> writes:

> TC 3.3.x has something like this.  You could look at the DependClassLoader
> there for some ideas.

Right. It seems that the ReloadInterceptor 
(http://tomcat.apache.org/tomcat-3.3-doc/serverxml.html#ReloadInterceptor)
does that. But why it has been removed?



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


Re: reload on demand

Posted by Eric Wertman <we...@comcast.net>.
WebSphere has this option on deployment, you can indicate that an app 
should poll it's class files every so often to see if there are any 
changes, and restart itself if it does.

It is a nice option to have, but I agree that I'd rather my computer 
program not do anything I didn't ask of it.

Kent Tong wrote:
> Yoav Shapira <yoavs <at> apache.org> writes:
> 
>> There will always be at least one manual step, because as things stand
>> right now a computer program can't read your mind ;)  You don't want
>> it to reload automatically when a specific resource (or resources)
>> is/are modified, you don't want it to reload automatically on a time
>> basis, you don't want to use the Manager HTML reload interface or the
>> Ant tasks that invoke it in a script... What automatic options remain?
>> ;)
> 
> The automatic option is when I access the webapp, Tomcat notes that
> some class file in it has changed and reload the webapp.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 
> 

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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Yoav Shapira <yoavs <at> apache.org> writes:

> The general idea is to reload an app when you know it needs to be
> reloaded, not when it's accessed, so as to minimize delays as seen by
> the users.  It's a basic principle of designing for performance.
> However, there's nothing written in stone that says you can't do what
> you want: go write the code and have a blast with it ;)  That's part
> of the fun of open-source software...

Thanks. That's pretty much what I thought (regarding performance). I'll
see what I can do to code it...




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


Re: reload on demand

Posted by Yoav Shapira <yo...@apache.org>.
Hi,

On 3/2/07, Kent Tong <ke...@cpttm.org.mo> wrote:
> Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:
>
> > sounds like you want the cake and eat it too, follow Yoav's suggestion,
> > and write a macro so that everytime you update a class you touch a
> > watched resource after the update has been complete
>
> I really don't understand. What's wrong with reloading a changed webapp
> whenever it is accessed?

The general idea is to reload an app when you know it needs to be
reloaded, not when it's accessed, so as to minimize delays as seen by
the users.  It's a basic principle of designing for performance.
However, there's nothing written in stone that says you can't do what
you want: go write the code and have a blast with it ;)  That's part
of the fun of open-source software...

Yoav

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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:

> besides having zero purpose in a production environment?

Right, it has no purpose in a production env. It's only used in
development.

> You've already been presented with so many options, take one of them and 
> use them, you can accomplish exactly what you are looking for, 

The Tomcat resources manager doesn't work at all as it doesn't reload
the whole webapp and still uses a timer.

> but I doubt anyone wants to actually add in code that you are suggesting into 
> the platform.

I am going to see if I can create a patch for that. So, this places
zero burden on you guys. The only question is whether this feature
is absolutely less or is worth something for some people?



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


Re: reload on demand

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Kent Tong wrote:
> Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:
>
>   
>> sounds like you want the cake and eat it too, follow Yoav's suggestion, 
>> and write a macro so that everytime you update a class you touch a 
>> watched resource after the update has been complete
>>     
>
> I really don't understand. What's wrong with reloading a changed webapp
> whenever it is accessed?
>   
besides having zero purpose in a production environment?
You've already been presented with so many options, take one of them and 
use them, you can accomplish exactly what you are looking for, but I 
doubt anyone wants to actually add in code that you are suggesting into 
the platform.

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


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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:

> sounds like you want the cake and eat it too, follow Yoav's suggestion, 
> and write a macro so that everytime you update a class you touch a 
> watched resource after the update has been complete

I really don't understand. What's wrong with reloading a changed webapp
whenever it is accessed?




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


Re: reload on demand

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Kent Tong wrote:
> Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:
>
>   
>> see that the solution I gave you, doesn't need to reload the app, it 
>> simply reloads the individual class file. for large apps, you don't have 
>> to wait for the entire app to reload
>> that would qualify as automatic too, wouldnt it?
>>     
>
> Thanks. I've taken a look at it. Here are some issues with it:
> 1) It still uses a timer. So it will still keep reloading when I
> am editing my files.
> 2) I have to specified which servlet classes to monitor. It seems
> there is no way to monitor all classes (including domain classes).
> 3) Reloading only a particular class will probably break the
> webapp (eg, when instances of classes hold references to its 
> instances).
>   
sounds like you want the cake and eat it too, follow Yoav's suggestion, 
and write a macro so that everytime you update a class you touch a 
watched resource after the update has been complete

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


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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:

> see that the solution I gave you, doesn't need to reload the app, it 
> simply reloads the individual class file. for large apps, you don't have 
> to wait for the entire app to reload
> that would qualify as automatic too, wouldnt it?

Thanks. I've taken a look at it. Here are some issues with it:
1) It still uses a timer. So it will still keep reloading when I
am editing my files.
2) I have to specified which servlet classes to monitor. It seems
there is no way to monitor all classes (including domain classes).
3) Reloading only a particular class will probably break the
webapp (eg, when instances of classes hold references to its 
instances).



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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:

> see that the solution I gave you, doesn't need to reload the app, it 
> simply reloads the individual class file. for large apps, you don't have 
> to wait for the entire app to reload
> that would qualify as automatic too, wouldnt it?

Thanks. I've taken a look at it. Here are some issues with it:
1) It still uses a timer. So it will still keep reloading when I
am editing my files.
2) I have to specified which servlet classes to monitor. It seems
there is no way to monitor all classes (including domain classes).
3) Reloading only a particular class will probably break the
webapp (eg, when instances of classes hold references to its 
instances).



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


Re: reload on demand

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Kent Tong wrote:
> Yoav Shapira <yoavs <at> apache.org> writes:
>
>   
>> There will always be at least one manual step, because as things stand
>> right now a computer program can't read your mind ;)  You don't want
>> it to reload automatically when a specific resource (or resources)
>> is/are modified, you don't want it to reload automatically on a time
>> basis, you don't want to use the Manager HTML reload interface or the
>> Ant tasks that invoke it in a script... What automatic options remain?
>> ;)
>>     
>
> The automatic option is when I access the webapp, Tomcat notes that
> some class file in it has changed and reload the webapp.
>   
see that the solution I gave you, doesn't need to reload the app, it 
simply reloads the individual class file. for large apps, you don't have 
to wait for the entire app to reload
that would qualify as automatic too, wouldnt it?
Filip
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>
>   


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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Yoav Shapira <yoavs <at> apache.org> writes:

> There will always be at least one manual step, because as things stand
> right now a computer program can't read your mind ;)  You don't want
> it to reload automatically when a specific resource (or resources)
> is/are modified, you don't want it to reload automatically on a time
> basis, you don't want to use the Manager HTML reload interface or the
> Ant tasks that invoke it in a script... What automatic options remain?
> ;)

The automatic option is when I access the webapp, Tomcat notes that
some class file in it has changed and reload the webapp.




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


Re: Re: reload on demand

Posted by Yoav Shapira <yo...@apache.org>.
Hi,

On 3/1/07, Kent Tong <ke...@cpttm.org.mo> wrote:
> Christophe Pierret <cpierret <at> sparus-software.com> writes:
>
> > Then you can create a dirty.txt file that you add as a WatchedRessource.
> > When you are ready to run, "touch" it and it will reload automatically.
>
> But then it takes an extra manual step, ie, touching the dirty.txt file,
> before accessing the webapp.

There will always be at least one manual step, because as things stand
right now a computer program can't read your mind ;)  You don't want
it to reload automatically when a specific resource (or resources)
is/are modified, you don't want it to reload automatically on a time
basis, you don't want to use the Manager HTML reload interface or the
Ant tasks that invoke it in a script... What automatic options remain?
;)

Yoav

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


Re: Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Christophe Pierret <cpierret <at> sparus-software.com> writes:

> Then you can create a dirty.txt file that you add as a WatchedRessource.
> When you are ready to run, "touch" it and it will reload automatically.

But then it takes an extra manual step, ie, touching the dirty.txt file,
before accessing the webapp.



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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:

> I wasn't referring to this attribute, I was referring to a classloaded 
> that reloads individual classes.
> I know this was done some time ago, not sure if it was included in 
> tomcat or not, but search the dev archives.

Thanks. But it is still reload at a certain interval (for a specifed
servlet, not the webapp). What I'd like is to reload the whole
webapp when it is accessed.



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


Re: reload on demand

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Kent Tong wrote:
> Yoav Shapira <yoavs <at> apache.org> writes:
>
>   
>> There's reloadable as a Context attribute, documented at
>> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html, and you
>> can also define a list of static resources (not classes) to be watched
>> to trigger a reload, via the WatchedResources element.  See the page
>> above and the default Context.xml that ships with Tomcat for an
>> example.
>>     
I wasn't referring to this attribute, I was referring to a classloaded 
that reloads individual classes.
I know this was done some time ago, not sure if it was included in 
tomcat or not, but search the dev archives.
>
> Yes, I know about the reloadable flag. But what I'd like is to
> reload it only when the webapp is accessed again. I don't
> want it to keep reloading when I make changes to my Java
> files. Only when I am ready to test run it, would I like it
> to reload automatically.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>
>   


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


Re: reload on demand

Posted by Kent Tong <ke...@cpttm.org.mo>.
Yoav Shapira <yoavs <at> apache.org> writes:

> There's reloadable as a Context attribute, documented at
> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html, and you
> can also define a list of static resources (not classes) to be watched
> to trigger a reload, via the WatchedResources element.  See the page
> above and the default Context.xml that ships with Tomcat for an
> example.

Yes, I know about the reloadable flag. But what I'd like is to
reload it only when the webapp is accessed again. I don't
want it to keep reloading when I make changes to my Java
files. Only when I am ready to test run it, would I like it
to reload automatically.



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


Re: reload on demand

Posted by Yoav Shapira <yo...@apache.org>.
Hola,

On 2/28/07, Kent Tong <ke...@cpttm.org.mo> wrote:
> Filip Hanik - Dev Lists <devlists <at> hanik.com> writes:
>
> > personally I don't see a very high value of it.
> > If I remember correctly, a different approach has already been
> > implemented using one more layer of classloaders.
> > you'd need to search around or someone might jump in and let you know
> > where it is.
>
> Is that classloader included in Tomcat?

There's reloadable as a Context attribute, documented at
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html, and you
can also define a list of static resources (not classes) to be watched
to trigger a reload, via the WatchedResources element.  See the page
above and the default Context.xml that ships with Tomcat for an
example.

Yoav

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