You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/08/14 07:40:23 UTC

Thinking aloud...

It seems like a cool enhancement to development with Turbine would be to
create something (a servlet?) that would spawn a thread that would sit
around in memory and constantly watch for changed .java files in a
particular directory. If one of the files changes, then it could run an Ant
build script to recompile the .java files. This would make Turbine "act"
more like JSP.

Anyone up to implement it? It shouldn't be hard.

-jon


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


Re: Thinking aloud...

Posted by Jon Stevens <jo...@latchkey.com>.
on 8/14/01 1:51 AM, "Leon Messerschmidt" <le...@opticode.co.za> wrote:

> Hi,
> 
> Won't the servlet engine reload the servlet if we recompile the .java
> classes?

Yes, if you have autoreload turned on.

> That is not to good for me for I do a bunch of initialization on
> the first hit (compiling a xsl stylesheet in particular > 5 seconds;  after
> the first hit things are OK), and I would prefer that the session is not
> lost.

If Turbine is running right and the container is working properly, the
session won't be lost.

> We solved it by using Jython for all our modules.  This gives the effect
> that Jon wants - you can edit your source code and changes are reflected
> immediately without a recompile.  The downside is that Jython is a strange
> beast at the best of times and we've had to create some workarounds....

Yup. Bad solution.

> I'm not an expert on this so feel free to tell me if I'm being stupid:  Will
> it make sense to create a custom class loader for modules?  The custom
> classloader can act in the following way:
> 
> 1.  On the first request it compiles a .java file (ant task or whatever else
> makes sense)
> 2.  On the next request it checks the .java file.
> 2.1  If it changed the class is recompiled and reloaded
> 2.2  If it did not change the current class is used
> 
> Any thoughts?

I'm loath to get into a custom classloader. You run into all sorts of nasty
issues when you do that.

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/ymtd/ymtd.html>


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


Re: Thinking aloud...

Posted by Leon Messerschmidt <le...@opticode.co.za>.
Hi,

Won't the servlet engine reload the servlet if we recompile the .java
classes?  That is not to good for me for I do a bunch of initialization on
the first hit (compiling a xsl stylesheet in particular > 5 seconds;  after
the first hit things are OK), and I would prefer that the session is not
lost.

We solved it by using Jython for all our modules.  This gives the effect
that Jon wants - you can edit your source code and changes are reflected
immediately without a recompile.  The downside is that Jython is a strange
beast at the best of times and we've had to create some workarounds....

I'm not an expert on this so feel free to tell me if I'm being stupid:  Will
it make sense to create a custom class loader for modules?  The custom
classloader can act in the following way:

1.  On the first request it compiles a .java file (ant task or whatever else
makes sense)
2.  On the next request it checks the .java file.
2.1  If it changed the class is recompiled and reloaded
2.2  If it did not change the current class is used

Any thoughts?

I'd be willing to give it a shot if you guys think it is feasible...

~ Leon

----- Original Message -----
From: "Jon Stevens" <jo...@latchkey.com>
To: "turbine-dev" <tu...@jakarta.apache.org>
Sent: Tuesday, August 14, 2001 8:19 AM
Subject: Re: Thinking aloud...


> How about this:
>
> When the Servlet is executed, it runs an Ant build script (it could even
> call Ant's engine directly from Java code without needing to start another
> JVM). The output of the build could be the response back to the browser.
>
> You could add an GET argument such that the servlet would also output a
meta
> refresh HTML tag with the seconds as the value.
>
> Something like:
>
> http://www.server.com/foo/servlet/antExecute?refresh=10
>
> Someone want to take this on...pretty PLEASE with sugar on top?
>
> -jon
>
> on 8/13/01 11:29 PM, "David Hanna" <dh...@esentience.com> wrote:
>
> > Interesting idea, especially if developers don't have ssh access to
their
> > dev server for some reason.  This type of polling solution might not be
> > the most reliable way however.  Maybe have a master servlet that checks
> > the date of the requested Servlet against it's corresponding java file.
> > If the java file is newer, recompile and hand over control otherwise
just
> > hand over control.
> >
> > My 2 cents.
> >
> > - Dave
> >
> >
> > On Mon, 13 Aug 2001, Jon Stevens wrote:
> >
> >> It seems like a cool enhancement to development with Turbine would be
to
> >> create something (a servlet?) that would spawn a thread that would sit
> >> around in memory and constantly watch for changed .java files in a
> >> particular directory. If one of the files changes, then it could run an
Ant
> >> build script to recompile the .java files. This would make Turbine
"act"
> >> more like JSP.
> >>
> >> Anyone up to implement it? It shouldn't be hard.
> >>
> >> -jon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>


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


Re: Thinking aloud...

Posted by Jon Stevens <jo...@latchkey.com>.
How about this:

When the Servlet is executed, it runs an Ant build script (it could even
call Ant's engine directly from Java code without needing to start another
JVM). The output of the build could be the response back to the browser.

You could add an GET argument such that the servlet would also output a meta
refresh HTML tag with the seconds as the value.

Something like:

http://www.server.com/foo/servlet/antExecute?refresh=10

Someone want to take this on...pretty PLEASE with sugar on top?

-jon

on 8/13/01 11:29 PM, "David Hanna" <dh...@esentience.com> wrote:

> Interesting idea, especially if developers don't have ssh access to their
> dev server for some reason.  This type of polling solution might not be
> the most reliable way however.  Maybe have a master servlet that checks
> the date of the requested Servlet against it's corresponding java file.
> If the java file is newer, recompile and hand over control otherwise just
> hand over control.
> 
> My 2 cents.
> 
> - Dave
> 
> 
> On Mon, 13 Aug 2001, Jon Stevens wrote:
> 
>> It seems like a cool enhancement to development with Turbine would be to
>> create something (a servlet?) that would spawn a thread that would sit
>> around in memory and constantly watch for changed .java files in a
>> particular directory. If one of the files changes, then it could run an Ant
>> build script to recompile the .java files. This would make Turbine "act"
>> more like JSP.
>> 
>> Anyone up to implement it? It shouldn't be hard.
>> 
>> -jon


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


Re: Thinking aloud...

Posted by David Hanna <dh...@esentience.com>.
Interesting idea, especially if developers don't have ssh access to their
dev server for some reason.  This type of polling solution might not be
the most reliable way however.  Maybe have a master servlet that checks
the date of the requested Servlet against it's corresponding java file.  
If the java file is newer, recompile and hand over control otherwise just
hand over control.

My 2 cents.

- Dave


On Mon, 13 Aug 2001, Jon Stevens wrote:

> It seems like a cool enhancement to development with Turbine would be to
> create something (a servlet?) that would spawn a thread that would sit
> around in memory and constantly watch for changed .java files in a
> particular directory. If one of the files changes, then it could run an Ant
> build script to recompile the .java files. This would make Turbine "act"
> more like JSP.
> 
> Anyone up to implement it? It shouldn't be hard.
> 
> -jon
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
> 


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