Re: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Simon Kitching
On Sat, 2009-01-10 at 19:56 -0700, Matthias Wessendorf wrote:
 On Sat, Jan 10, 2009 at 11:21 AM, Jan-Kees van Andel
 jankeesvanan...@gmail.com wrote:
  I don't think Scannotation itself is an issue, but it has a required
  dependency on Javassist, which has an LGPL license. Isn't that a
  problem?
 
 hrm, I think not really, b/c it's not a direct dependency.

I'm pretty sure that scannotation's dependency on an LGLP project is a
showstopper. There is some brief info here:
   http://www.apache.org/legal/resolved.html

I'm not sure this approach is a good one anyway. Javasisst's jar is
560kb. That's a fairly heavy dependency for such a simple task as
scanning for annotations.

Regards,
Simon



RE: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Mario Ivankovits
Hi!

 -Original Message-
 From: Jan-Kees van Andel [mailto:jankeesvanan...@gmail.com]
 Mario, I've been looking at the Shale code that handles the annotation
 scanning, but I saw it uses Reflection and standard Java ClassLoaders
 for scanning the classpath for JSF artifacts. What's your experience
 with the performance of this? Does Shale heavily rely on specifying a
 base package to be efficient?

Hmmm, it is a long time back we used it  at least during development times 
it was very annoying not having specified the packages. If I remember 
correctly, with defining it, scanning-time drop down from something aroung 30 
seconds to under 1 second.

Wouldn't it be sufficient to do it that way for a first version of MyFaces 2.0?
Do you think Mojarra will come up with a more sophisticated solution which 
bypasses the standard reflection stuff and uses something like Javasisst? I 
doubt.

Ciao,
Mario


Re: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Mark Struberg
Fwik Javassist uses a Mozilla Public License 1.1 not a pure LGPL (though I've 
not checked explicitly for the javassist version we use).

MPL 1.1 is explicitly listed as appropriate license at least.

Maybe we can kick scannotation, and do the scanning ourself (in a later phase). 
But Javassist is imho a big deal, because we don't need to class-load all 
classes. 
Otoh I have to admit that I've never did any performance/memory tests comparing 
them both.

LieGrue,
strub

--- Simon Kitching skitch...@apache.org schrieb am So, 11.1.2009:

 Von: Simon Kitching skitch...@apache.org
 Betreff: Re: Scanning for annotated classes in MyFaces 2
 An: MyFaces Development dev@myfaces.apache.org
 Datum: Sonntag, 11. Januar 2009, 12:06
 On Sat, 2009-01-10 at 19:56 -0700, Matthias Wessendorf
 wrote:
  On Sat, Jan 10, 2009 at 11:21 AM, Jan-Kees van Andel
  jankeesvanan...@gmail.com wrote:
   I don't think Scannotation itself is an
 issue, but it has a required
   dependency on Javassist, which has an LGPL
 license. Isn't that a
   problem?
  
  hrm, I think not really, b/c it's not a direct
 dependency.
 
 I'm pretty sure that scannotation's dependency on
 an LGLP project is a
 showstopper. There is some brief info here:
http://www.apache.org/legal/resolved.html
 
 I'm not sure this approach is a good one anyway.
 Javasisst's jar is
 560kb. That's a fairly heavy dependency for such a
 simple task as
 scanning for annotations.
 
 Regards,
 Simon





RE: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Mario Ivankovits
Hi!

 not sure on the PERF, but if it is really (proven) the case, I am with
 you.
 Well... startup time isn't really a big problem, right? :-)

Is that ironic?
In projects with 3000 classes and 60 jar files you are up to 30 seconds, or 
even more, scanning time.
Under load, with shale, I saw scanning times of 60 seconds.
This _will_ drive you crazy!

Ciao,
Mario


Re: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Simon Kitching
Yep, I should have checked the original statement. The javassist website
here:
  http://www.jboss.org/javassist/
states clearly that:
quote
License: You can choose either MPL or LGPL.
/quote

Surprising for a jboss project, but the website clearly says so.

The MPL is no problem. So using Scannotation is also fine.

I'm still not convinced that adding a 560kb dependency for such a simple task 
is optimal, but simply getting *any* solution in place for myfaces is better 
than doing multiple scans. It can always be further improved later..

Regards, Simon

On Sun, 2009-01-11 at 11:45 +, Mark Struberg wrote:
 Fwik Javassist uses a Mozilla Public License 1.1 not a pure LGPL (though I've 
 not checked explicitly for the javassist version we use).
 
 MPL 1.1 is explicitly listed as appropriate license at least.
 
 Maybe we can kick scannotation, and do the scanning ourself (in a later 
 phase). But Javassist is imho a big deal, because we don't need to class-load 
 all classes. 
 Otoh I have to admit that I've never did any performance/memory tests 
 comparing them both.
 
 LieGrue,
 strub
 
 --- Simon Kitching skitch...@apache.org schrieb am So, 11.1.2009:
 
  Von: Simon Kitching skitch...@apache.org
  Betreff: Re: Scanning for annotated classes in MyFaces 2
  An: MyFaces Development dev@myfaces.apache.org
  Datum: Sonntag, 11. Januar 2009, 12:06
  On Sat, 2009-01-10 at 19:56 -0700, Matthias Wessendorf
  wrote:
   On Sat, Jan 10, 2009 at 11:21 AM, Jan-Kees van Andel
   jankeesvanan...@gmail.com wrote:
I don't think Scannotation itself is an
  issue, but it has a required
dependency on Javassist, which has an LGPL
  license. Isn't that a
problem?
   
   hrm, I think not really, b/c it's not a direct
  dependency.
  
  I'm pretty sure that scannotation's dependency on
  an LGLP project is a
  showstopper. There is some brief info here:
 http://www.apache.org/legal/resolved.html
  
  I'm not sure this approach is a good one anyway.
  Javasisst's jar is
  560kb. That's a fairly heavy dependency for such a
  simple task as
  scanning for annotations.
  
  Regards,
  Simon
 
 
   



Re: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Cagatay Civici
I've checked mojarra 2.0 some time ago to see how do they implemented this,
well they're using reflection/class way.

Spring's scanning mechanism also gives out of memory if you dont specify a
sub package name to scan.

So, my thought is to implement this in myfaces, it's not a complicated task
as we all discussed. And if we do implement it, we get the advantage of
tuning it
for better performance in a web environment.

C.C.

On Sun, Jan 11, 2009 at 11:46 AM, Mario Ivankovits ma...@ops.co.at wrote:

 Hi!

  not sure on the PERF, but if it is really (proven) the case, I am with
  you.
  Well... startup time isn't really a big problem, right? :-)

 Is that ironic?
 In projects with 3000 classes and 60 jar files you are up to 30 seconds, or
 even more, scanning time.
 Under load, with shale, I saw scanning times of 60 seconds.
 This _will_ drive you crazy!

 Ciao,
 Mario



Re: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Stephen Friedrich

My 2 cents: Don't load classes to use java.lang.reflect on it:
- What if a class does something bad (or just about anything) in a static 
initializer?
  For example  try to run the code below. It will EXIT THE VM
- Can you be sure that those classes are unloaded again?
- Performance: It is _faster_ to use a library (like javassist), because the
  class loader must effectively parse the byte code, too, plus then do a lot
  more (like validation).

package com.acme.foo;

class Exit {
static {
System.exit(-1);
}
}

public class Main {
public static void main(String[] args) throws InterruptedException, 
ClassNotFoundException {
Class? clazz = Class.forName(com.acme.foo.Exit);
while(true) {
Thread.sleep(1000);
System.out.println(System.currentTimeMillis() / 1000);
}
}
}



Cagatay Civici wrote:
I've checked mojarra 2.0 some time ago to see how do they implemented 
this, well they're using reflection/class way.


Spring's scanning mechanism also gives out of memory if you dont specify 
a sub package name to scan.


So, my thought is to implement this in myfaces, it's not a complicated 
task as we all discussed. And if we do implement it, we get the 
advantage of tuning it

for better performance in a web environment.

C.C.

On Sun, Jan 11, 2009 at 11:46 AM, Mario Ivankovits ma...@ops.co.at 
mailto:ma...@ops.co.at wrote:


Hi!

  not sure on the PERF, but if it is really (proven) the case, I am
with
  you.
  Well... startup time isn't really a big problem, right? :-)

Is that ironic?
In projects with 3000 classes and 60 jar files you are up to 30
seconds, or even more, scanning time.
Under load, with shale, I saw scanning times of 60 seconds.
This _will_ drive you crazy!

Ciao,
Mario






Re: Scanning for annotated classes in MyFaces 2

2009-01-11 Thread Matthias Wessendorf
On Sun, Jan 11, 2009 at 4:46 AM, Mario Ivankovits ma...@ops.co.at wrote:
 Hi!

 not sure on the PERF, but if it is really (proven) the case, I am with
 you.
 Well... startup time isn't really a big problem, right? :-)

 Is that ironic?

;-) I really hate to wait on the boot-up.
:-)


 In projects with 3000 classes and 60 jar files you are up to 30 seconds, or 
 even more, scanning time.
 Under load, with shale, I saw scanning times of 60 seconds.
 This _will_ drive you crazy!

 Ciao,
 Mario




-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf