tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1166290 - /tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
Date Mon, 12 Sep 2011 11:15:55 GMT
2011/9/7 Mark Thomas <markt@apache.org>:
> On 07/09/2011 19:49, Konstantin Kolinko wrote:
>> 2011/9/7  <markt@apache.org>:
>>> Author: markt
>>> Date: Wed Sep  7 18:11:20 2011
>>> New Revision: 1166290
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1166290&view=rev
>>> Log:
>>> Add a simple annotation cache to improve performance for applications that use
lots of non-poolable tags.
>>
>> 1. I think most classes do not have annotations. If I understand
>> correctly the code allocates new ArrayList() for each class. Maybe we
>> can optimize for classes that do not have annotations?
>> (E.g. using a shared instance of Collections.emptyList()).
>
> That would be simple to do.

Ok, I like how you did it.

>> 2. I wonder when the cache is cleared. E.g. if we are in development
>> mode or have enabled unloading unused JSPs in JspServlet
>> configuration. If I understand correctly it accumulates references to
>> Class objects but never releases them.
>
> When the context is stopped.

This issue is still pending.
Though I think it concerns only development mode, and benefits of this
cache out-weight the resource leak.


3. Regarding the instances not created through the instance manager:
http://svn.apache.org/viewvc?rev=1166775&view=rev

The code is now skipping annotations in those classes.
The old code would scan them for preDestroy annotations.
I have not looked what behaviour is required by the specs here, but I
think that the old behaviour was more correct.

4. There is code that calls setAccessible() for Method, e.g.:

                Method postConstruct = (Method) entry.getAccessibleObject();
                boolean accessibility = postConstruct.isAccessible();
                postConstruct.setAccessible(true);
                postConstruct.invoke(instance);
                postConstruct.setAccessible(accessibility);

There will be a race condition if several threads are changing
(setting or restoring) the method accessibility flag on the same
Method right before invoke() or isAccessible() calls.

Best regards,
Konstantin Kolinko

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


Mime
View raw message