dev@glassfish.java.net

Re: Local Strings in GlassFish

From: vince kraemer <vince.kraemer_at_oracle.com>
Date: Tue, 20 Jul 2010 17:43:07 -0700

Tom: Thanks for the pointer to a prototypical case...

All:

After reading through the diff, I have to wonder... why not replace 'new
LocalStringsImpl(Foo.class)' with
'LocalStringsImpl.getInstance(Foo.class)' where getInstance(Foo.class)
would manage the instances of LocalStringsImpl.

An initial impl of getInstance(Foo.class) would just do a new... later
the getInstance could manage a cache of LocalStringsImpl instances,
indexed by the package of the class sent in...

That would probably help prevent the instance explosion that seems to be
the motivation for this change.

It seems like this would prevent a lot of code duplication, since there
would need to be over 250 Strings.java classes written to implement this
proposal across the GlassFish Server 3.1 code base. Any change that
needs to be made to Strings would need to be made 250+ times, too.

But I am probably missing something obvious...

vbk

Tom Mueller wrote:
> Here you go:
>
> http://fisheye4.atlassian.com/changelog/glassfish-svn?cs=37341
>
> This change has a bit more than just the Strings.java change.
>
> Tom
>