<div dir="ltr">If it&#39;s actually a util object can you make it stateless so that it is thread safe? Maybe add an additional context type object for state if you really need it. Attaching it to the exchange as an attachment could work.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 5, 2018 at 7:36 AM, Steve Hu <span dir="ltr">&lt;<a href="mailto:stevehu@gmail.com" target="_blank">stevehu@gmail.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">I was thinking about ThreadLocal as it is very popular in Java EE but one request might be handled by multiple threads from IO thread to worker thread which means you have to instantiate as many objects as the number of total threads. Just trying to find if there are any better solutions. Thanks for your confirmation. </div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 5, 2018 at 7:19 AM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@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"><div dir="auto">If you want one per thread just use ThreadLocal.<span class="m_-4460753247278018887HOEnZb"><font color="#888888"><div dir="auto"><br></div><div dir="auto">Stuart</div></font></span></div><br><div class="gmail_quote"><div><div class="m_-4460753247278018887h5"><div dir="ltr">On Thu, 5 Apr. 2018, 7:42 pm Steve Hu, &lt;<a href="mailto:stevehu@gmail.com" target="_blank">stevehu@gmail.com</a>&gt; wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-4460753247278018887h5"><div dir="ltr"><span style="color:rgb(0,0,0);font-family:SourceSansLocal,source-sans-pro,&quot;Source Sans Pro&quot;,-apple-system,Roboto,&quot;pt sans&quot;,calibri,sans-serif;font-size:16px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgba(240,240,240,0.3);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I need to share the same instance of a &quot;Util&quot; object to reuse it in all the handleRequest calls. Where is the best place to store the Util object instance? The </span><font color="#000000" face="SourceSansLocal, source-sans-pro, Source Sans Pro, -apple-system, Roboto, pt sans, calibri, sans-serif"><span style="font-size:16px">Util class is not thread safe, so I should have one instance for each client thread.</span></font><div><font color="#000000" face="SourceSansLocal, source-sans-pro, Source Sans Pro, -apple-system, Roboto, pt sans, calibri, sans-serif"><span style="font-size:16px"><br></span></font></div><div><font color="#000000" face="SourceSansLocal, source-sans-pro, Source Sans Pro, -apple-system, Roboto, pt sans, calibri, sans-serif"><span style="font-size:16px">Thanks,</span></font></div><div><font color="#000000" face="SourceSansLocal, source-sans-pro, Source Sans Pro, -apple-system, Roboto, pt sans, calibri, sans-serif"><span style="font-size:16px"><br></span></font></div><div><font color="#000000" face="SourceSansLocal, source-sans-pro, Source Sans Pro, -apple-system, Roboto, pt sans, calibri, sans-serif"><span style="font-size:16px">Steve<br></span></font><div><br></div></div></div></div></div><span>
______________________________<wbr>_________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" rel="noreferrer" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer noreferrer" target="_blank">https://lists.jboss.org/mailma<wbr>n/listinfo/undertow-dev</a></span></blockquote></div>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br></blockquote></div><br></div>