On Mon, Jan 16, 2017 at 10:45 AM, Roy Golan <[email protected]> wrote: > 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. > > Managed executor service is a thread pool resource, manage by the container > and can be controlled via JMX or the startup ovirt-egine.xml.in 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 > > In the engine we are using mutli pools, with little to no capabilities of > tweaking them > - ThreadPoolUtil - our general threading facade > - SchedulerThreadPool - the pool we create to pass to quarz
We use 2 pools for quartz with the same implementation > - HostUpdatesCheckerService.java - internal pool > - CommandExecutor - coco's pool There is one more pool use for vdsm event processing: - ForkJoinPool - created with async mode set > > 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. I like the idea to managed pool provided by the container but we should revised our way of using threads first before we will take any decisions. > > Following this thread, if there is no suitable bug already, I'll open one > for this. > > Some code snippets: > > @Resource > private ManagedExecutorService mes; > > ... Future f = mes.submit(() -> doThis()) > > > The configuration in ovirt-engine.xml.in (already there today!): > > <managed-executor-services> > <managed-executor-service > name="default" > jndi-name="java:jboss/ee/concurrency/executor/default" > context-service="default" > thread-factory="default" > hung-task-threshold="60000" > core-threads="5" > max-threads="25" > keepalive-time="5000" > queue-length="1000000" > reject-policy="RETRY_ABORT" /> > </managed-executor-services> > > 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) > > [1] > https://docs.jboss.org/author/display/WFLY8/EE+Concurrency+Utilities+Configuration > [2] > http://www.adam-bien.com/roller/abien/entry/injecting_an_executorservice_with_java > > > > > _______________________________________________ > Devel mailing list > [email protected] > http://lists.ovirt.org/mailman/listinfo/devel _______________________________________________ Devel mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/devel
