struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Wannemacher <w...@wantii.com>
Subject Re: use of private final vs. protected
Date Wed, 03 Jun 2009 15:23:55 GMT
On Wed, Jun 3, 2009 at 11:14 AM, Al Sutton <al@funkyandroid.com> wrote:
> Back in the dim and distant past I remember final being used to give the JIT an optimization
hint that whatever's described as final can be inlined as it won't change (note JIT not compiler).
It's not a big saving, but in tight loops and heavily called code it can all add up.
>
> I found http://www.javaperformancetuning.com/tips/final.shtml which expands on it a bit.
>
> Al.
>


That makes sense, Al, but in cases like this (non-primitives) all it
does is finalize the reference. So the referred objects are not
immutable, and I guess I was just wondering whether the optimization
that final provides in this case is worth the pain it causes for
subclassing.

I agree with Musachy, we should be careful using private and final,
especially in struts since we inject objects like this. I figured I
could subclass it, make some changes and then have the plugin define a
bean overriding the definition that comes from core. With the fields
defined the way they are, it's not possible. I'll make the changes to
JakartaMultiPartRequest, but wanted to make sure I wasn't breaking
some rule.

Funny side-note... So I was reading all the JavaDocs on commons
file-upload and low-and-behold, who wrote most of the classes I was
looking at? Our own Martin Cooper! So, Martin, you wanna help out with
enhancing struts2 file uploading capabilities? 8-D

-Wes


-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Mime
View raw message