<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 16, 2017 at 4:45 AM, Roy Golan <span dir="ltr">&lt;<a href="mailto:rgolan@redhat.com" target="_blank">rgolan@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Java EE 7 included ManageExecutorService in its spec. Using Wildfly (as certified EE 7 container) we can use it to replace our own ThreadPoolUtil implementation and (possibly) Quarz usage. <br><br></div>Managed executor service is a thread pool resource, manage by the container and can be controlled via JMX or the startup <a href="http://ovirt-egine.xml.in" target="_blank">ovirt-egine.xml.in</a> facility. This means that it could be tweaked at runtime as well. The service has configured thread factory and queue as well, all described by the xml<br><br></div><div>In the engine we are using mutli pools, with little to no capabilities of tweaking them<br>- ThreadPoolUtil - our general threading facade<br></div><div>- SchedulerThreadPool - the pool we create to pass to quarz<br>- HostUpdatesCheckerService.java - internal pool<br></div><div>- CommandExecutor - coco&#39;s pool<br><br></div><div>EE gave us a standard way to handle threads, with runtime configuration and ability to @inject it into the code, this means once again less code with using something the platform already supplies with real tuninig abilities. I know #infra has an item quarts, this should be considered as well.<br></div><div><br></div><div>Following this thread, if there is no suitable bug already, I&#39;ll open one for this.<br></div></div></blockquote><div><br></div><div>+1.</div><div><br></div><div>We started using this for the dashboard in a recent patch [3] by Scott:</div><div><br></div><div><div>@Resource</div><div>private ManagedScheduledExecutorService scheduledExecutor;</div></div><div><br></div><div>[3] <a href="https://gerrit.ovirt.org/#/c/67709/7/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/dashboard/DashboardDataServlet.java">https://gerrit.ovirt.org/#/c/67709/7/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/dashboard/DashboardDataServlet.java</a><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Some code snippets:  <br></div><pre><code>@Resource
private ManagedExecutorService mes;<br></code></pre><pre><code>...  Future f = mes.submit(() -&gt; doThis())</code><br></pre><div><br></div><div>The configuration in <a href="http://ovirt-engine.xml.in" target="_blank">ovirt-engine.xml.in</a> (already there today!):<br></div></div></blockquote><div><br></div><div>Yep, added by [3] above :)</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div><div class="gmail-m_-986787202511607780gmail-container" title="Hint: double-click to select code"><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number1 gmail-m_-986787202511607780gmail-index0 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">&lt;</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-keyword">managed-executor-services</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">&gt;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number2 gmail-m_-986787202511607780gmail-index1 gmail-m_-986787202511607780gmail-alt1"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">&lt;</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-keyword">managed-executor-service</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number3 gmail-m_-986787202511607780gmail-index2 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">name</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;default&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number4 gmail-m_-986787202511607780gmail-index3 gmail-m_-986787202511607780gmail-alt1"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">jndi-name</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;java:jboss/ee/<wbr>concurrency/executor/default&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number5 gmail-m_-986787202511607780gmail-index4 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">context-service</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;default&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number6 gmail-m_-986787202511607780gmail-index5 gmail-m_-986787202511607780gmail-alt1"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">thread-factory</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;default&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number7 gmail-m_-986787202511607780gmail-index6 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">hung-task-threshold</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;60000&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number8 gmail-m_-986787202511607780gmail-index7 gmail-m_-986787202511607780gmail-alt1"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">core-threads</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;5&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number9 gmail-m_-986787202511607780gmail-index8 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">max-threads</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;25&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number10 gmail-m_-986787202511607780gmail-index9 gmail-m_-986787202511607780gmail-alt1"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">keepalive-time</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;5000&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number11 gmail-m_-986787202511607780gmail-index10 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">queue-length</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;1000000&quot;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number12 gmail-m_-986787202511607780gmail-index11 gmail-m_-986787202511607780gmail-alt1"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-spaces">  </code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-color1">reject-policy</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">=</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-string">&quot;RETRY_ABORT&quot;</code> <code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">/&gt;</code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number13 gmail-m_-986787202511607780gmail-index12 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">&lt;/</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-keyword">managed-executor-services</code><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">&gt;<br><br></code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number13 gmail-m_-986787202511607780gmail-index12 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain">Please head here for wildfly docs [1] and here [2] to see a simple example (from one of the members of the EG of EE, recommended blog in general)<br><br>[1] <a href="https://docs.jboss.org/author/display/WFLY8/EE+Concurrency+Utilities+Configuration" target="_blank">https://docs.jboss.org/author/<wbr>display/WFLY8/EE+Concurrency+<wbr>Utilities+Configuration</a><br>[2] <a href="http://www.adam-bien.com/roller/abien/entry/injecting_an_executorservice_with_java" target="_blank">http://www.adam-bien.com/<wbr>roller/abien/entry/injecting_<wbr>an_executorservice_with_java</a><br><br></code></div><div class="gmail-m_-986787202511607780gmail-line gmail-m_-986787202511607780gmail-number13 gmail-m_-986787202511607780gmail-index12 gmail-m_-986787202511607780gmail-alt2"><code class="gmail-m_-986787202511607780gmail-xml gmail-m_-986787202511607780gmail-plain"><br></code></div></div><br></div></div>
<br>______________________________<wbr>_________________<br>
Devel mailing list<br>
<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Greg Sheremeta, MBA<br>Red Hat, Inc.<br>Sr. Software Engineer<br><a href="mailto:gshereme@redhat.com" target="_blank">gshereme@redhat.com</a><br></div></div></div>
</div></div>