Open hutchig opened 3 years ago
Question: What executor shall we return?: I don't think we can offer the 'default' executor for two reasons: 1 - there is a server wide mechanism for replacing this (i.e the one that CICS uses) and 2 - we need to constrain it to an executor that uses the ThreadFactory that is passed in in https://github.com/eclipse-vertx/vert.x/issues/3434.
Question: How many Executors shall we have in the system?: I do not think logically that the provided Executor can be a singleton. Why?...because the callers of the Executor factory method in https://github.com/eclipse-vertx/vert.x/issues/3434 can call the factory method passing different ThreadFactory's and must receive back Executors that make use of those. The least number of executors would be one per object instance of ThreadFactory that was used in the factory method (e.g. by checking a map-cache before creation and returning one if found.)
Before we code/deliver it with #12471, we need to make sure that the Liberty architects, the Vert.x community and the Narwhal team agree to the design we will be building to. So this work item is to enforce that we don't just build 'something' based on our assumptions and then p
https://github.com/eclipse-vertx/vert.x/issues/3434
See: https://ibm.ent.box.com/notes/721707366318
Which Executor Instance do we want to make accessible?
Do we want the ExecutorService to be a Singleton, one per invocation, other?
What aspects of the Executor should we fix/allow configuration?
What contexts will we allow to be propagated?
Examples of ServiceLoader-loadable Executors elsewhere: [ From Nathan Rauh]: If the concept of ServiceLoader-loadable Executors is already used as an integration point, it would be helpful if you could point us at the source where this is used (if it's open source and already exists) so that we can explore how that pattern is being used. It does seem like something that could become a more general pattern. [See also refs at the bottom]
What are the non-functional requirements that allow for RAS, metrics, tracing etc in 'normal' Liberty workloads that we need to ensure carries over. Can these all be covered if work is coming in from a 'foreign' environment - like Vert.x or Quarkus code?
What do we NOT WANT to set up that we might normally set up for work that is initiated from a JEE context?
What about the shutdown of an ExecutorService (independently of Liberty?) What about shutting down tasks gracefully in shutdown.
References:
https://stackoverflow.com/questions/24903658/spring-threadpooltaskexecutor-vs-java-executorservice-cachedthreadpool (Mentions JMX and configuration variables)
Spring's @Async (cf MP @Blocking) : https://dzone.com/articles/spring-and-threads-async https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/annotation/EnableAsync.html for: @Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(7); executor.setMaxPoolSize(42); executor.setQueueCapacity(11); executor.setThreadNamePrefix("MyExecutor-"); executor.initialize(); return executor; }
Liberty's PolicyExecutor: https://github.com/OpenLiberty/open-liberty/issues/93