<br><font size=2 face="sans-serif">Yes, but my point was that separating
lifecycle out in that way would make it harder to enforce constraints like
&quot;if a module's state is initialised, the module's activator completed
successfully&quot;.</font>
<br>
<br><font size=2 face="sans-serif">JSR 291 solved this problem with additional
module states and error handling. It also supports lazy module initialisation
triggered by the first class load from a module. How much of this should
JSR 277 re-invent?</font>
<br><font size=2 face="sans-serif"><br>
Glyn</font>
<br>
<br><font size=1 face="sans-serif"><b>Bryan Atsatt &lt;bryan.atsatt@ORACLE.COM&gt;</b></font><tt><font size=2>
wrote on 22/06/2007 06:12:48 PM:<br>
<br>
&gt; I think that is part of Stanley's point here: the module system isn't<br>
&gt; responsible, as it merely generates the events. Some *other* system<br>
&gt; could then take on lifecycle based on these events.<br>
&gt; <br>
&gt; Glyn Normington wrote:<br>
&gt; &gt;<br>
&gt; &gt; Hmmm. I thought so too (apart from reinventing the OSGi lifecycle
event,<br>
&gt; &gt; of course), but I wonder if the module system needs to be directly<br>
&gt; &gt; responsible for driving an activator in case it fails to terminate
(in<br>
&gt; &gt; which case the module needs to enter some kind of error or inactive
state)?<br>
&gt; &gt;<br>
&gt; &gt; Glyn<br>
&gt; &gt;<br>
&gt; &gt; *&quot;Richard S. Hall&quot; &lt;heavy@UNGOVERNED.ORG&gt;* wrote
on 22/06/2007 01:21:48 PM:<br>
&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; I think your suggestion is reasonable.<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; -&gt; richard<br>
&gt; &gt; &nbsp;&gt;<br>
&gt; &gt; &nbsp;&gt; Stanley M. Ho wrote:<br>
&gt; &gt; &nbsp;&gt; &gt; Hi JSR 277 experts,<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Since we have been discussing some issues around
the module instances'<br>
&gt; &gt; &nbsp;&gt; &gt; lifetime lately, I think it's probably a good
time to bring up a<br>
&gt; &gt; related<br>
&gt; &gt; &nbsp;&gt; &gt; topic for discussion.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; As I reviewed the feedbacks from the EDR comments,
from our previous<br>
&gt; &gt; &nbsp;&gt; &gt; discussions, as well as from my discussions with
the teams in SE<br>
&gt; &gt; and EE,<br>
&gt; &gt; &nbsp;&gt; &gt; there were a few suggestions related to the module
instances'lifetime:<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; 1. The module system shall provide a way to monitor
various events,<br>
&gt; &gt; e.g.<br>
&gt; &gt; &nbsp;&gt; &gt; module initialized, module released, etc.<br>
&gt; &gt; &nbsp;&gt; &gt; 2. The module system shall allow a module to
have activator code. The<br>
&gt; &gt; &nbsp;&gt; &gt; activator code would be executed right before
the module is fully<br>
&gt; &gt; &nbsp;&gt; &gt; initialized and when the instance is released.<br>
&gt; &gt; &nbsp;&gt; &gt; 3. A module shall have a way to be stopped.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; Having these suggestions don't mean we have to
do all of them, and I<br>
&gt; &gt; &nbsp;&gt; &gt; would like to get your inputs.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; From my perspective, having a way to monitor
module system's events<br>
&gt; &gt; &nbsp;&gt; &gt; (i.e. #1) seems very reasonable and useful, especially
the use<br>
&gt; &gt; cases are<br>
&gt; &gt; &nbsp;&gt; &gt; very common. In fact, many teams in SE have expressed
the needs in<br>
&gt; &gt; &nbsp;&gt; &gt; monitoring the module system's events in their
class libraries in some<br>
&gt; &gt; &nbsp;&gt; &gt; degrees, so these libraries would react and behave
appropriately. There<br>
&gt; &gt; &nbsp;&gt; &gt; are also other class libraries sitting on top
of the JRE that have<br>
&gt; &gt; &nbsp;&gt; &gt; similar needs.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; For #2, this is a use case I gathered from EE,
and this would be used<br>
&gt; &gt; &nbsp;&gt; &gt; mainly for registering and unregistering services
when a module has<br>
&gt; &gt; been<br>
&gt; &gt; &nbsp;&gt; &gt; initialized or is released. Not that I think
this is unimportant, but I<br>
&gt; &gt; &nbsp;&gt; &gt; am not yet convinced this is something we need
to support directly at<br>
&gt; &gt; &nbsp;&gt; &gt; the module system level. For instance, if the
module system<br>
&gt; &gt; notification<br>
&gt; &gt; &nbsp;&gt; &gt; mechanism (i.e. #1) is available, it should be
possible for the EE<br>
&gt; &gt; &nbsp;&gt; &gt; server (or other apps that require similar functionality)
to build a<br>
&gt; &gt; &nbsp;&gt; &gt; simple activator layer on top of the module system.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; For #3, the use case is that some EE servers
might want to have the<br>
&gt; &gt; &nbsp;&gt; &gt; ability to &quot;stop&quot; a module by disabling
the module's classloader when<br>
&gt; &gt; &nbsp;&gt; &gt; the module instance is released. In general,
disabling a classloader is<br>
&gt; &gt; &nbsp;&gt; &gt; an uncommon and dangerous operation to perform,
and it also<br>
&gt; &gt; violates the<br>
&gt; &gt; &nbsp;&gt; &gt; current classloading spec. While I agreed we
should make this use case<br>
&gt; &gt; &nbsp;&gt; &gt; possible, I don't think this is something we
want to push into the<br>
&gt; &gt; &nbsp;&gt; &gt; module system.; I believe there are alternatives
we could consider to<br>
&gt; &gt; &nbsp;&gt; &gt; achieve the same result. For example, suppose
there are APIs available<br>
&gt; &gt; &nbsp;&gt; &gt; to disable a classloader (might come from the
classloading project) and<br>
&gt; &gt; &nbsp;&gt; &gt; the module system notification mechanism (i.e.
#1) is available, it<br>
&gt; &gt; &nbsp;&gt; &gt; should be possible for the EE servers to hook
into the notification<br>
&gt; &gt; &nbsp;&gt; &gt; mechanism, and disable the specific classloader
it wants when a module<br>
&gt; &gt; &nbsp;&gt; &gt; instance is released from the module system.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; To keep things simple, I suggest we should support
#1, and I hope this<br>
&gt; &gt; &nbsp;&gt; &gt; should be sufficient to enable other applications
(e.g. EE servers) to<br>
&gt; &gt; &nbsp;&gt; &gt; support #2 and #3. I would like to hear what
your thoughts are.<br>
&gt; &gt; &nbsp;&gt; &gt;<br>
&gt; &gt; &nbsp;&gt; &gt; - Stanley<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; ------------------------------------------------------------------------<br>
&gt; &gt;<br>
&gt; &gt; /<br>
&gt; &gt; /<br>
&gt; &gt;<br>
&gt; &gt; /Unless stated otherwise above:<br>
&gt; &gt; IBM United Kingdom Limited - Registered in England and Wales
with number<br>
&gt; &gt; 741598.<br>
&gt; &gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU/<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
</font></tt><font size=3 face="sans-serif"><br>
</font>
<br><font size=3 face="sans-serif"><br>
</font>
<hr><font size=2 face="sans-serif"><br>
<i><br>
</i></font>
<p><font size=2 face="sans-serif"><i>Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU</i></font>
<p><font size=2 face="sans-serif"><br>
</font><font size=3 face="sans-serif"><br>
</font>
<br>
<br><font size=3 face="sans-serif"><br>
</font>