You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Werner Punz <we...@gmail.com> on 2009/12/25 15:53:34 UTC

ext-scripting class dependency scanning added

Hello everyone I was busy the last days while the baby was sleeping.

I added class dependency scanning for java (not in groovy yet we have
to move from the internal groovy parser to the groovy compiler to enable it)

What does this mean.

If you have a component MyComponent and a renderer for instance

and you have a construct in the renderer

((MyComponent)uiComponent).doSomething()

and you change the component, then the renderer at the next reload is 
also reloaded, that way you wont get Classcast exceptions because the 
renderer is kept in ram while the component class and component is 
refreshed.

This works on all artefacts and should reduce the number of server 
restarts tremendously.

Another Example

BlogService has application scope
BlogView has request scope

both use BlogEntry as Object which is stored and generated on demand!

Now if you change Blogservice, BlogView is also marked as to be reloaded 
because it references BlogService with a cast and an include!

If you change BlogEntry, both BlogService and BlogView are marked as to 
be reloaded to keep the classes in sync!


The good thing is, for instance if you have a utils class and have it 
referenced over various artefacts, then chaning the utils class
will cause a reload of the artefacts which include the utils class as well!

Downside, I had to reintroduce the asm dependency unfortunately, and 
currently it only works in java (in groovy you can bypass the casting 
issue for now by using def) and for speed and other reasons it only 
works on artefacts which are loaded dynamically not in precompiled ones!


So what is left.
a) Bernhard wants to move the entire compile cycle away from the refresh 
  to the scanning tasks for various reasons. (This also will improve the 
behavior in the case of doing a hot change of code on a running server - 
if done right)

b) Bernhard wants to add a bean dependency map to allow a better bean 
restart algorithm, currently if a bean is changed we refresh all dynamic 
ally loaded beans (we cannot go away from this even with the class 
dependencies because beans can be wired also over plain Object references)

c) Some optimization and cleanup tasks have to be performed.
There are some parts of the code I am very unhappy with yet,
because some stuff was trial and error.

d) The documentation of course!

Anyway have fun with the new feature and happy christmas everyone!