0

I am using

ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor()

in my web app to accept a completable future with timeout. but in the vaadin webapp the class loader of executor threads is bootstrap class loader. I want to get this initialized by parallel webapp class loader to use libraries in web inf folder. (This is required to load glassfish jaxb) please assist. java version is 11 and tomcat version is 9.0.43

  • 1
    Basically you need to create your own executor and wrap all submitted tasks, like in [this answer](https://stackoverflow.com/a/66396818/11748454). – Piotr P. Karwasz Mar 07 '21 at 15:01
  • 2
    [Specify a thread factory](https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/concurrent/Executors.html#newSingleThreadScheduledExecutor(java.util.concurrent.ThreadFactory)) that creates the thread and sets the context loader. – Holger Mar 09 '21 at 13:45
  • Thank you. but in some linux versions the completable future initiated from different threads such as thread-1 , thread-2 etc. these threads contains webapp class loader. how this happen? – Hasintha Samith Randika Mar 17 '21 at 04:22

0 Answers0