Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspectj and jsp load

Hi,

I did a bit more work on it.  You can now use aop.xml.  Here is the weaver:

http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/dev/aspectjweaver-skiploaders2.jar

the setting is:

<weaver options="-loadersToSkip:com.foo.Bar,com.boo.Foo"/>

If you additionally turn on -verbose you'll see this line come out

[AppClassLoader@1ef6a746] info no longer creating weavers for these
classloaders: [com.foo.Bar, com.boo.Foo]

when a weaver discovers this setting.  Once that line is shown, all
future classloaders will be checked against the list.

The system property is still supported too.

I'm doing the work under this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=368046

if you want to track when it gets committed.  Commits may get a short
delay whilst we coordinate migrating to git from cvs.

cheers,
Andy


On 5 January 2012 15:35, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
> The problem with allowing that setting in aop.xml is that I'd have to
> initialize the weaver enough to discover the aop.xml and determine
> that it didn't have to do anything - normally the settings in the
> aop.xml are just for the instance of the weaver that is discovering
> that aop.xml.  A system property completely avoids all this messing
> about, but I understand it can be a bit more fiddly to configure.
>
> mmm, but I suppose if it is treated as a kind 'global' setting then I
> could use aop.xml.  The first time any aop.xml file is encountered,
> this value would apply across all future classloaders encountered in
> the system.  In a 'typical' configuration where some other
> classloaders are encountered first (before your Jsp ones), this would
> probably behave how we'd like.
>
> The list is comma delimited, yes.
>
> Andy
>
> On 5 January 2012 15:08, yohan chandra <yohan.chandra@xxxxxxxxx> wrote:
>> Thanks,
>>
>> It works nicely, below is some log:
>>     Line 24: aj.weaving.loadersToSkip is set.  Skipping loaders:
>> 'weblogic.servlet.jsp.JspClassLoader'
>>     Line 172: aj.weaving.loadersToSkip = weblogic.servlet.jsp.JspClassLoader
>>     Line 7611: debug: no weaver created for loader
>> 'weblogic.servlet.jsp.JspClassLoader'
>>     Line 7623: debug: no weaver created for loader
>> 'weblogic.servlet.jsp.JspClassLoader'
>>     Line 7624: debug: no weaver created for loader
>> 'weblogic.servlet.jsp.JspClassLoader'
>>     Line 7625: debug: no weaver created for loader
>> 'weblogic.servlet.jsp.JspClassLoader'
>>     Line 7656: debug: no weaver created for loader
>> 'weblogic.servlet.jsp.JspClassLoader'
>>     Line 7672: debug: no weaver created for loader
>> 'weblogic.servlet.jsp.JspClassLoader'
>> the weaver is not created for any JspClassLoader and the page is loaded very
>> fast. with precompiled jsp, the jsp is displayed instantly, no more delay.
>> Thanks a lot for the help.
>>
>> Is it possible to configure this outside of system property? probably in
>> aop.xml?
>> aj.weaving.loadersToSkip=weblogic.servlet.jsp.JspClassLoader
>>
>> How to set if I want to skip more loaders? is it coma delimited?
>>
>> Regards,
>> - Yohan -
>>
>>
>> On Wed, Jan 4, 2012 at 6:18 PM, Andy Clement <andrew.clement@xxxxxxxxx>
>> wrote:
>>>
>>> ok, I just decided to implement what might help you here, if it proves
>>> successful I'll commit it.  You will need to use this special dev
>>> build of AspectJ weaver:
>>>
>>>
>>> http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/dev/aspectjweaver-skiploaders.jar
>>>
>>> and set this system property:
>>> aj.weaving.loadersToSkip=weblogic.servlet.jsp.JspClassLoader
>>>
>>> You will see debug output if the system property is picked up and then
>>> again when loaders are ignored, like this:
>>>
>>> aj.weaving.loadersToSkip is set.  Skipping loaders:
>>> 'sun.misc.Launcher$AppClassLoader'
>>>
>>> debug: no weaver created for loader 'sun.misc.Launcher$AppClassLoader'
>>>
>>> I imagine you are just suffering the startup time of the weaver.  let
>>> me know how that works out for you.
>>>
>>> Incidentally the 'long' match times you are seeing for those spring
>>> related pointcuts should improve with Spring 3.1, I saw a jira go by
>>> the other day about optimizing them.
>>>
>>> cheers,
>>> Andy
>>>
>>> On 3 January 2012 12:12, yohan chandra <yohan.chandra@xxxxxxxxx> wrote:
>>> > Hi,
>>> >
>>> >> Are you confident your pointcuts aren't doing unnecessary matching, as
>>> >> that will also hurt startup time.  Are they all using within() clauses
>>> >> to guard the set of types against which they will apply?  You might
>>> >> want to use the timers support to see if the pointcuts are spending a
>>> >> lot of time matching:
>>> >>
>>> >>
>>> >> http://andrewclement.blogspot.com/2009/a11/aspectj-profiling-pointcut-matching.html
>>> >
>>> >
>>> > for within() clauses, I use include within options from aop.xml and only
>>> > include necessary classes, for example:
>>> >         <include
>>> > within="com.services.factory.account.AccountDbServicesCareImpl"/>
>>> >         <include
>>> > within="com.services.factory.mobile.MobileDbServicesCareImpl"/>
>>> >         <include
>>> >
>>> > within="com.services.factory.resetpassword.CommonResetPasswordServicesImpl"/>
>>> >         <include within="com.services.tlg.utils.AddContractUtil"/>
>>> >         <include within="com.servlets.SalesPortalServlet"/>
>>> >         <include within="com.utils.CareComLogon"/>
>>> >         <include within="com.utils.CareLogonUtil"/>
>>> >         <include within="com.utils.CSSUtil"/>
>>> >         . . . .
>>> >
>>> > I have enabled the -timers option and below are from the logs:
>>> > Line 4199: [ChangeAwareClassLoader@1e50bd5] info Pointcut fast matching
>>> > cost
>>> > (total=101ms for 3000 fast match calls):
>>> > Line 4226: [ChangeAwareClassLoader@1e50bd5] info Pointcut matching cost
>>> > (total=7805ms for 50000 joinpoint match calls):
>>> >
>>> > I checked the time logs, most of them are about 0-2ms, several 200ish
>>> > ms,
>>> > only two are outstanding (>1000ms):
>>> > fast matching:
>>> > Line 4200: [ChangeAwareClassLoader@1e50bd5] info Time:31ms (types:#428)
>>> > fast
>>> > matching against ((((execution(* *(..)) &&
>>> > this(BindingTypePattern(java.lang.Object, 0))) &&
>>> > @annotation(org.springframework.transaction.annotation.Transactional))
>>> > &&
>>> >
>>> > persingleton(org.springframework.transaction.aspectj.AnnotationTransactionAspect))
>>> > || (((execution(public *
>>> > (@org.springframework.transaction.annotation.Transactional *).*(..)) &&
>>> > this(BindingTypePattern(java.lang.Object, 0))) &&
>>> > @this(org.springframework.transaction.annotation.Transactional)) &&
>>> >
>>> > persingleton(org.springframework.transaction.aspectj.AnnotationTransactionAspect)))
>>> > Line 4205: [ChangeAwareClassLoader@1e50bd5] info Time:1ms (types:#108)
>>> > fast
>>> > matching against (((call(*
>>> > com.cv.webservices.client.GenerateOOWQuestionsAnswers_Impl.*(..)) &&
>>> > if())
>>> > && persingleton(com.aspect.CustomerVerifyAdvice)) || ((call(*
>>> > com.cv.webservices.client.GenerateOOWQuestionsAnswersPortType.*(..)) &&
>>> > if()) && persingleton(com.aspect.CustomerVerifyAdvice)))
>>> >
>>> > matching:
>>> > Line 4227: [ChangeAwareClassLoader@1e50bd5] info Time:1745ms (jps:#4104)
>>> > matching against ((((execution(* *(..)) &&
>>> > this(BindingTypePattern(java.lang.Object, 0))) &&
>>> > @annotation(org.springframework.transaction.annotation.Transactional))
>>> > &&
>>> >
>>> > persingleton(org.springframework.transaction.aspectj.AnnotationTransactionAspect))
>>> > || (((execution(public *
>>> > (@org.springframework.transaction.annotation.Transactional *).*(..)) &&
>>> > this(BindingTypePattern(java.lang.Object, 0))) &&
>>> > @this(org.springframework.transaction.annotation.Transactional)) &&
>>> >
>>> > persingleton(org.springframework.transaction.aspectj.AnnotationTransactionAspect)))
>>> > Line 4233: [ChangeAwareClassLoader@1e50bd5] info Time:4174ms (jps:#8095)
>>> > matching against (((call(*
>>> > com.cv.webservices.client.GenerateOOWQuestionsAnswers_Impl.*(..)) &&
>>> > if())
>>> > && persingleton(com.aspect.CustomerVerifyAdvice)) || ((call(*
>>> > com.cv.webservices.client.GenerateOOWQuestionsAnswersPortType.*(..)) &&
>>> > if()) && persingleton(com.aspect.CustomerVerifyAdvice)))
>>> >
>>> > However I don't think the matching time is the issue because our
>>> > application
>>> > does not weave anything to the jsp classes (jsp is not even included in
>>> > our
>>> > aop.xml), I checked the log all this weaving time info is from
>>> > changeAwareClassLoader only, nothing from the jspClassLoader.
>>> >
>>> > I observed the log, when the jsp is loaded, changeAwareClassLoader is
>>> > not
>>> > printing any log, the only related aspectj logs are registration of
>>> > jspclassloaders and the aspects.
>>> >
>>> > I took the log for a page in our application and found out 8 jsp
>>> > classloaders were registered and each registration took about ~1-2s (the
>>> > log
>>> > was moving slowly and after 1-2s another jsp class loader registration
>>> > started and took about the same time)
>>> > ...
>>> > [JspClassLoader@14e2e89] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@14e2e89] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@14e2e89
>>> > . . .
>>> > [JspClassLoader@1b150] info AspectJ Weaver Version 1.6.9 built on Monday
>>> > Jul
>>> > 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@1b150] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@1b150
>>> > . . .
>>> > [JspClassLoader@1201afd] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@1201afd] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@1201afd
>>> > . . .
>>> > [JspClassLoader@c0cd51] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@c0cd51] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@c0cd51
>>> > . . .
>>> > [JspClassLoader@146b6a1] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@146b6a1] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@146b6a1
>>> > . . .
>>> > [JspClassLoader@1b52826] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@1b52826] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@1b52826
>>> > . . .
>>> > [JspClassLoader@1521eab] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@1521eab] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@1521eab
>>> > . . .
>>> > [JspClassLoader@1cdee1f] info AspectJ Weaver Version 1.6.9 built on
>>> > Monday
>>> > Jul 5, 2010 at 15:28:35 GMT
>>> > [JspClassLoader@1cdee1f] info register classloader
>>> > weblogic.servlet.jsp.JspClassLoader@1cdee1f
>>> >
>>> >
>>> > Regards,
>>> > - yohan chandra -
>>> >
>>> >
>>> > _______________________________________________
>>> > aspectj-users mailing list
>>> > aspectj-users@xxxxxxxxxxx
>>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>> >
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>>
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>


Back to the top