<div dir="ltr">No there is no bug, it is expected to ensure consistency on shutdown</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 14, 2013 at 2:45 PM, Juraci Paixão Kröhling <span dir="ltr">&lt;<a href="mailto:jcosta@redhat.com" target="_blank">jcosta@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Nicolas,<br>
<br>
I would like to thank you for the links and information you sent. It was<br>
very useful!<br>
<br>
I spent some more time in debugging and reading the documentation, but I<br>
can&#39;t help and wonder if I&#39;m not hitting a bug on the stop() method for<br>
RepositoryContainer.<br>
<br>
See, the start() method initializes itself and then starts the dependent<br>
components, by calling super.start(). I would expect the reverse<br>
behaviour on the stop method, in that it stops all components and then<br>
stop itself, but that&#39;s not what&#39;s happening:<br>
<br>
<a href="http://git.io/hfnATA" target="_blank">http://git.io/hfnATA</a><br>
<br>
Making it to be the reverse logic as the start() method seems to indeed<br>
fix the issue with the WSRP component during shutdown:<br>
<br>
Shutdown logs for the current behaviour:<br>
<a href="http://pastebin.com/g5vNrbPJ" target="_blank">http://pastebin.com/g5vNrbPJ</a><br>
<br>
Shutdown logs for the patched code:<br>
<a href="http://pastebin.com/FYcr5zbK" target="_blank">http://pastebin.com/FYcr5zbK</a><br>
<br>
If this is indeed a bug, I can send a PR with the following commit:<br>
<br>
<a href="http://git.io/ZbZNXg" target="_blank">http://git.io/ZbZNXg</a><br>
<br>
Regards,<br>
Juca.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 11/12/2013 11:07 AM, Nicolas Filotto wrote:<br>
&gt; Generally speaking the doc of eXo JCR is hosted on your web site<br>
&gt; here <a href="http://www.jboss.org/exojcr/documentation" target="_blank">http://www.jboss.org/exojcr/documentation</a><br>
&gt;<br>
&gt; We don&#39;t have any doc that describes how the kernel works as it is<br>
&gt; implementation specific and it could change from one version to another.<br>
&gt; For example with the new multi-threaded kernel, the way it is done, is<br>
&gt; already different from the current kernel. What I meant by &quot;did you<br>
&gt; check it?&quot;, I meant : did you check the code?<br>
&gt;<br>
&gt; Let me try to explain simply without getting into too much details (if I<br>
&gt; can).<br>
&gt;<br>
&gt; In your configuration files, you define all the components. According to<br>
&gt; the location of those files, they can be affected either to the<br>
&gt; RootContainer or to the PortalContainer(s) in case of the portal mode<br>
&gt; which is the mode used by Gatein. In case of the standalone mode, they<br>
&gt; will be affected to the StandaloneContainer. All those containers are<br>
&gt; ExoContainers, when you start an ExoContainer behind the scene it first<br>
&gt; gets all the components of type Startable, then it instantiates them,<br>
&gt; and finally it starts them. Any time a component is instantiated it is<br>
&gt; added to a List. This List will be used to define the startup sequence.<br>
&gt; It will also be used to define the shutdown sequence by reversing it.<br>
&gt;<br>
&gt; To make it clear, let&#39;s give an example, let&#39;s say that we have A that<br>
&gt; depends on B and B that depends on C, and A and C are Startable.<br>
&gt; The kernel gets all the components of type Startable, so it gets A and<br>
&gt; C. Then it tries to instantiate them, so first it will try to<br>
&gt; instantiate A but for that it will need to instantiate C because of B,<br>
&gt; so the first element in the list will be C, then B, then A. To get our<br>
&gt; startup sequence we keep only the Startable components of this List, so<br>
&gt; we will have only C and A. So it will first start C then A, and will<br>
&gt; stop A then C.<br>
&gt;<br>
&gt; So far, I believe that it was clear for you, the use case that you<br>
&gt; mention is actually a specific one. In the hierarchy of ExoContainers<br>
&gt; (in portal more), we have first the RootContainer, then we can have one<br>
&gt; or more PortalContainer(s), then we can have one or more<br>
&gt; RepositoryContainer(s) (we have one RepositoryContainer per repository)<br>
&gt; and finally we can have one or more WorkspaceContainer(s) (we have one<br>
&gt; WorkspaceContainer per workspace). The PortalContainers are created by<br>
&gt; the RootContainer and the RepositoryContainer(s)/WorkspaceContainer(s)<br>
&gt; are created, initialized and started by the RepositoryService at startup.<br>
&gt;<br>
&gt; Why do I see the RepositoryContainer in the shutdown sequence ?<br>
&gt; Because the RepositoryContainer is added to the PortalContainer and an<br>
&gt; ExoContainer is Startable<br>
&gt;<br>
&gt; Why the RepositoryContainer is the first element in the shutdown sequence ?<br>
&gt; Because it is added in the startup phase so all the Startable components<br>
&gt; are already instantiated and added to the List that defines the startup<br>
&gt; sequence, which means that it will be the last element in the List so<br>
&gt; the first element to be stopped<br>
&gt;<br>
&gt; Why I don&#39;t see the RepositoryContainer in the startup sequence?<br>
&gt; Because it is added after by the RepositoryService in the startup phase<br>
&gt;<br>
&gt; Why do you create/initialize/start the RepositoryContainer in the start<br>
&gt; method of RepositoryService?<br>
&gt; Because this service depends on component plugins, so we need to be sure<br>
&gt; that we have all of them before creating the repositories and the<br>
&gt; workspaces which is only possible in the start method<br>
&gt;<br>
&gt; I hope it is clear enough now<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Nov 12, 2013 at 8:59 AM, Juraci Paixão Kröhling<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; &lt;<a href="mailto:jcosta@redhat.com">jcosta@redhat.com</a> &lt;mailto:<a href="mailto:jcosta@redhat.com">jcosta@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 11/11/2013 05:47 PM, Nicolas Filotto wrote:<br>
&gt;     &gt; To be able to understand that you need to understand how the kernel<br>
&gt;     &gt; works, did you check it?<br>
&gt;<br>
&gt;     To be honest, I couldn&#39;t find much information about how the kernel<br>
&gt;     works, other than the overview in the reference guide and by looking at<br>
&gt;     the code, with a debugger attached :-) I&#39;m trying to read as much as I<br>
&gt;     can, but it seems that the information for contributors is spread in<br>
&gt;     some places and not following some structure, making it a bit hard to<br>
&gt;     put the things together.<br>
&gt;<br>
&gt;     If you could suggest some particular reading or approach, I&#39;d<br>
&gt;     appreciate!<br>
&gt;<br>
&gt;     Thanks,<br>
&gt;     Juca.<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div>