[picocontainer-dev] Desired behavior for Picocontainer and Static injection
"Michael Rimov" <[email protected]> Tue, 4 Jun 2013 22:04:42 -0700
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Organization | Centerline Computers, Inc. |
| Message-ID | <[email protected]> |
------=_NextPart_000_0656_01CE616F.84B82D90
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Ok, so this is the last thing on the todo list to get the TCK + all optional
tests running for JSR-330.
The TCK wants static initialization, but to keep track of things so that we
only inject statics one time.
To me that means we have to maintain some sort of state about what's been
initialized, but what scope?
Do we do it across all containers? (ie a static variable inside default
picocontainer) (for the record, my own personal opinion on this solution.
ick!)
Personally I'm of the opinion that we keep track of static initialization
once per container. (via a Non static member variable, probably a
WeakHashSet. weak so it doesn't prevent classloaders from gc'ing a class?)
If we have multiple containers (not in a parent-child way) referencing the
same class, then it would mean that a static variable will be initialized
multiple times, but personally I think this is an edge case behavior that we
can live with compared to having to have Static variables inside DPC.
I suppose a complicated way would be to run a class enhancer to offload the
state information there. but that seems like a lot of work for what we would
call an recommended way of doing things.
Thoughts?
-Mike
------=_NextPart_000_0656_01CE616F.84B82D90
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal>Ok, so =
this is the last thing on the todo list to get the TCK + all optional =
tests running for JSR-330.<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>The TCK =
wants static initialization, but to keep track of things so that we only =
inject statics one time.<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>To me that =
means we have to maintain some sort of state about what’s been =
initialized, but what scope?<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>Do we do it =
across all containers? (ie a static variable inside default =
picocontainer) (for the record, my own personal opinion on this =
solution… ick!)<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>Personally =
I’m of the opinion that we keep track of static initialization =
once per container. (via a Non static member variable, probably a =
WeakHashSet… weak so it doesn’t prevent classloaders from =
gc’ing a class?) <o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>If we have =
multiple containers (not in a parent-child way) referencing the same =
class, then it would mean that a static variable will be initialized =
multiple times, but personally I think this is an edge case behavior =
that we can live with compared to having to have Static variables inside =
DPC. <o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal>I suppose a complicated way would be to run a class =
enhancer to offload the state information there… but that seems =
like a lot of work for what we would call an recommended way of doing =
things.<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal>Thoughts?<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal> &=
nbsp; &n=
bsp; &nb=
sp; &nbs=
p;  =
; =
&=
nbsp; &n=
bsp; &nb=
sp; &nbs=
p;  =
; =
&=
nbsp; &n=
bsp; =
-Mike<o:p></o:p></p></div></body></html>
------=_NextPart_000_0656_01CE616F.84B82D90--