<div dir="ltr"><div>I believe that this problem is related to <a href="https://github.com/exoplatform/ws/commit/50a829a047ff91a1f358d9ef2536486dceb320ec">https://github.com/exoplatform/ws/commit/50a829a047ff91a1f358d9ef2536486dceb320ec</a><br>
</div><div><br></div><div>It seems to me that RequestLifeCycle.end() is being called sooner than expected in  <a href="https://github.com/exoplatform/ws/blob/2.4.0-Alpha3/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestHandlerImpl.java">https://github.com/exoplatform/ws/blob/2.4.0-Alpha3/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestHandlerImpl.java</a><br>
</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 29 November 2013 15:15, Nicolas Filotto <span dir="ltr">&lt;<a href="mailto:nicolas.filotto@exoplatform.com" target="_blank">nicolas.filotto@exoplatform.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There are many things that have been added between Alpha1 and Alpha3, so I will need more details. What do you mean exactly by &quot;<span style="font-family:arial,sans-serif;font-size:13px">strange behavior with some ThreadLocal&lt;&gt; variables&quot;?</span><div>


<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Please note that I don&#39;t work on Fridays so I will answer next week once I will have more details</span></div>


</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 28, 2013 at 8:46 PM, Lucas Ponce <span dir="ltr">&lt;<a href="mailto:lponce@redhat.com" target="_blank">lponce@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">Nicolas,<br>
<br>
Do you know if there is some change related multithreading between kernel 2.5.0-Alpha3 and 2.5.0-Alpha1 ?<br>
<br>
Debugging a class I&#39;m seeing some strange behaviour with some ThreadLocal&lt;&gt; variables.<br>
<br>
Thanks again,<br>
Lucas<br>
<br>
----- Mensaje original -----<br>
&gt; De: &quot;Nicolas Filotto&quot; &lt;<a href="mailto:nicolas.filotto@exoplatform.com" target="_blank">nicolas.filotto@exoplatform.com</a>&gt;<br>
&gt; Para: &quot;Lucas Ponce&quot; &lt;<a href="mailto:lponce@redhat.com" target="_blank">lponce@redhat.com</a>&gt;<br>
&gt; CC: &quot;gatein-dev&quot; &lt;<a href="mailto:gatein-dev@lists.jboss.org" target="_blank">gatein-dev@lists.jboss.org</a>&gt;<br>
&gt; Enviados: Jueves, 28 de Noviembre 2013 18:08:29<br>
&gt; Asunto: Re: [gatein-dev] SessionManagerContainer in exo.kernel.container 2.6.0-Alpha3<br>
&gt;<br>
&gt; If you use the SessionManagerContainer, why don&#39;t you have a compilation<br>
&gt; error ?<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Nov 28, 2013 at 4:50 PM, Lucas Ponce &lt;<a href="mailto:lponce@redhat.com" target="_blank">lponce@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Hello Nicolas,<br>
&gt; &gt;<br>
&gt; &gt; POMSessionManager.java needs to access to SessionContext at this point:<br>
&gt; &gt;<br>
&gt; &gt;     public POMSession getSession() {<br>
&gt; &gt;         SessionContext context = configurator.getContext();<br>
&gt; &gt;         return context != null ? (POMSession)<br>
&gt; &gt; context.getAttachment(&quot;mopsession&quot;) : null;<br>
&gt; &gt;     }<br>
&gt; &gt;<br>
&gt; &gt; This is needed to PortalNamesCache.java to perform a query to<br>
&gt; &gt; POMDataStorage component:<br>
&gt; &gt;<br>
&gt; &gt;     @Override<br>
&gt; &gt;     public &lt;V&gt; V execute(POMSession session, POMTask&lt;V&gt; task) throws<br>
&gt; &gt; Exception {<br>
&gt; &gt;         if (!session.isModified()) {<br>
&gt; &gt;             if (task instanceof SearchTask.FindSiteKey) {<br>
&gt; &gt;                 SearchTask.FindSiteKey find = (SearchTask.FindSiteKey)<br>
&gt; &gt; task;<br>
&gt; &gt;                 List&lt;PortalKey&gt; data = (List&lt;PortalKey&gt;)<br>
&gt; &gt; session.getFromCache(find.getKey());<br>
&gt; &gt;                 if (data == null) {<br>
&gt; &gt;                     V result = super.execute(session, task);<br>
&gt; &gt;                     LazyPageList&lt;PortalKey&gt; list =<br>
&gt; &gt; (LazyPageList&lt;PortalKey&gt;) result;<br>
&gt; &gt;                     session.putInCache(find.getKey(),<br>
&gt; &gt; Collections.unmodifiableList(new ArrayList&lt;PortalKey&gt;(list.getAll())));<br>
&gt; &gt;                     return result;<br>
&gt; &gt;                 } else {<br>
&gt; &gt;                     return (V) new LazyPageList&lt;PortalKey&gt;(new<br>
&gt; &gt; ListAccessImpl&lt;PortalKey&gt;(PortalKey.class, data), 10);<br>
&gt; &gt;                 }<br>
&gt; &gt;             } else if (task instanceof PortalConfigTask.Save || task<br>
&gt; &gt; instanceof PortalConfigTask.Remove) {<br>
&gt; &gt;                 V result = super.execute(session, task);<br>
&gt; &gt;<br>
&gt; &gt; session.scheduleForEviction(SearchTask.FindSiteKey.PORTAL_KEY);<br>
&gt; &gt;<br>
&gt; &gt; session.scheduleForEviction(SearchTask.FindSiteKey.GROUP_KEY);<br>
&gt; &gt;                 return result;<br>
&gt; &gt;             }<br>
&gt; &gt;         }<br>
&gt; &gt;<br>
&gt; &gt;         //<br>
&gt; &gt;         return super.execute(session, task);<br>
&gt; &gt;     }<br>
&gt; &gt;<br>
&gt; &gt; With the current change of version in exo.core, the getSession() in<br>
&gt; &gt; POMSessionManager is always null, so a NPE is thrown breaking the POM<br>
&gt; &gt; service.<br>
&gt; &gt;<br>
&gt; &gt; I wonder how I can integrate these new changes to have same behaviour that<br>
&gt; &gt; previous version.<br>
&gt; &gt;<br>
&gt; &gt; Thanks,<br>
&gt; &gt; Lucas<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; ----- Mensaje original -----<br>
&gt; &gt; &gt; De: &quot;Nicolas Filotto&quot; &lt;<a href="mailto:nicolas.filotto@exoplatform.com" target="_blank">nicolas.filotto@exoplatform.com</a>&gt;<br>
&gt; &gt; &gt; Para: &quot;Lucas Ponce&quot; &lt;<a href="mailto:lponce@redhat.com" target="_blank">lponce@redhat.com</a>&gt;<br>
&gt; &gt; &gt; CC: &quot;gatein-dev&quot; &lt;<a href="mailto:gatein-dev@lists.jboss.org" target="_blank">gatein-dev@lists.jboss.org</a>&gt;<br>
&gt; &gt; &gt; Enviados: Jueves, 28 de Noviembre 2013 17:29:27<br>
&gt; &gt; &gt; Asunto: Re: [gatein-dev] SessionManagerContainer in exo.kernel.container<br>
&gt; &gt; 2.6.0-Alpha3<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; What is the need exactly ? Beeing able to scope a component to a Session?<br>
&gt; &gt; &gt; If so it is now possible to define a scope to a component thanks to<br>
&gt; &gt; &gt; <a href="https://jira.exoplatform.org/browse/KER-258" target="_blank">https://jira.exoplatform.org/browse/KER-258</a>. Out of the box, the kernel<br>
&gt; &gt; &gt; supports the scope Singleton, ApplicationScoped and Dependent. By adding<br>
&gt; &gt; &gt; some configuration you can extend the list to SessionScoped and<br>
&gt; &gt; &gt; RequestScoped. Here is the configuration to add if you want both:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &lt;component&gt;<br>
&gt; &gt; &gt; &lt;key&gt;org.exoplatform.container.context.ContextManager&lt;/key&gt;<br>
&gt; &gt; &gt;  &lt;type&gt;org.exoplatform.container.context.ContextManagerImpl&lt;/type&gt;<br>
&gt; &gt; &gt; &lt;component-plugins&gt;<br>
&gt; &gt; &gt; &lt;component-plugin&gt;<br>
&gt; &gt; &gt;  &lt;name&gt;main-scopes&lt;/name&gt;<br>
&gt; &gt; &gt; &lt;set-method&gt;addContexts&lt;/set-method&gt;<br>
&gt; &gt; &gt; &lt;type&gt;org.exoplatform.container.context.ContextPlugin&lt;/type&gt;<br>
&gt; &gt; &gt;  &lt;init-params&gt;<br>
&gt; &gt; &gt; &lt;object-param&gt;<br>
&gt; &gt; &gt; &lt;name&gt;request-scope&lt;/name&gt;<br>
&gt; &gt; &gt;  &lt;object type=&quot;org.exoplatform.container.context.RequestContext&quot;/&gt;<br>
&gt; &gt; &gt; &lt;/object-param&gt;<br>
&gt; &gt; &gt;  &lt;object-param&gt;<br>
&gt; &gt; &gt; &lt;name&gt;session-scope&lt;/name&gt;<br>
&gt; &gt; &gt; &lt;object type=&quot;org.exoplatform.container.context.SessionContext&quot;/&gt;<br>
&gt; &gt; &gt;  &lt;/object-param&gt;<br>
&gt; &gt; &gt; &lt;/init-params&gt;<br>
&gt; &gt; &gt; &lt;/component-plugin&gt;<br>
&gt; &gt; &gt;  &lt;/component-plugins&gt;<br>
&gt; &gt; &gt; &lt;/component&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Please note that the components that you want to scope to SessionScoped<br>
&gt; &gt; or<br>
&gt; &gt; &gt; RequestScoped must be proxyable as they are normal scopes (which means<br>
&gt; &gt; that<br>
&gt; &gt; &gt; you will access to the methods through a proxy and you must not access to<br>
&gt; &gt; &gt; the fields directly), moreover components that you want to scope to<br>
&gt; &gt; &gt; SessionScoped must be Serializable as SessionScoped is a passivating<br>
&gt; &gt; scope.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Please also note that thanks to KER-252 you can use the annotations<br>
&gt; &gt; defined<br>
&gt; &gt; &gt; in JSR 330 such as Inject<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Thu, Nov 28, 2013 at 3:36 PM, Lucas Ponce &lt;<a href="mailto:lponce@redhat.com" target="_blank">lponce@redhat.com</a>&gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Hello,<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; There is a issue in current master that is impacting to REST management<br>
&gt; &gt; &gt; &gt; services in GateIn.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; <a href="https://issues.jboss.org/browse/GTNPORTAL-3308" target="_blank">https://issues.jboss.org/browse/GTNPORTAL-3308</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Investigating it looks like that issue appears since migration to<br>
&gt; &gt; &gt; &gt; 2.6.0-Alpha3 core.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Main symptom is a NPE in POMSessionManager class:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; <a href="https://github.com/gatein/gatein-portal/blob/428874e25ee9e6dada3fd1a54a4aa9f02f42d641/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java#L224-L229" target="_blank">https://github.com/gatein/gatein-portal/blob/428874e25ee9e6dada3fd1a54a4aa9f02f42d641/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java#L224-L229</a><br>



&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; One of the changes of 2.6.0-Alpha3 is to drop the<br>
&gt; &gt; SessionManagerContainer<br>
&gt; &gt; &gt; &gt; interface from PortalContainer.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Is there a workaround to access to same functionality in order to fix<br>
&gt; &gt; this<br>
&gt; &gt; &gt; &gt; issue ?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Thanks in advance,<br>
&gt; &gt; &gt; &gt; Lucas<br>
&gt; &gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; &gt; gatein-dev mailing list<br>
&gt; &gt; &gt; &gt; <a href="mailto:gatein-dev@lists.jboss.org" target="_blank">gatein-dev@lists.jboss.org</a><br>
&gt; &gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
gatein-dev mailing list<br>
<a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br><font><b>Trong Tran</b></font><br style="color:rgb(102,102,102);font-family:&#39;trebuchet ms&#39;,sans-serif">



<span style="color:rgb(102,102,102);font-family:&#39;trebuchet ms&#39;,sans-serif"></span><span style="color:rgb(102,102,102);font-family:&#39;trebuchet ms&#39;,sans-serif"><i><span style="color:rgb(102,102,102);font-family:&#39;trebuchet ms&#39;,sans-serif">(+84) 983841909 <span style="color:rgb(255,153,0)">|</span></span> </i></span><span style="font-family:&#39;trebuchet ms&#39;,sans-serif"><span style="color:rgb(102,102,102)"><span><a href="mailto:trongtt@gmail.com" target="_blank">trongtt@gmail.com</a><br>
Twitter: <a href="http://twitter.com/trongtt" target="_blank">http://twitter.com/trongtt</a></span></span></span><span style="font-family:&#39;trebuchet ms&#39;,sans-serif"><span style="color:rgb(102,102,102)"><span><span style="color:rgb(102,102,102);font-family:&#39;trebuchet ms&#39;,sans-serif"><i><span style="color:rgb(102,102,102);font-family:&#39;trebuchet ms&#39;,sans-serif"><span style="color:rgb(255,153,0)"></span></span></i></span></span></span></span><span style="font-family:&#39;trebuchet ms&#39;,sans-serif"></span>
</div>