Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-12098

Thread context class loader is wrong for ScheduledExecutorService threads

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • None
    • 16.0.0.Final
    • Concurrency Utilities
    • None

    Description

      Tasks submitted to the standard ScheduledExecutorService (JNDI: java:comp/DefaultManagedScheduledExecutorService) are executed in threads with class loader that cannot find application classes. This is a regression in 16.0 compared to 14.0 (haven't tested 15). Tasks submitted to the simple ExecutorService (JNDI: java:comp/DefaultManagedExecutorService) see the correct class loader.

      I.e. if I submit something like

      () ->

      { System.out.println (Thread.currentThread ().getContextClassLoader (); }

      to both services (i.e. exactly the same task), I get the following output. For ScheduledExecutorService (wrong):

      ModuleClassLoader for Module "org.jboss.as.ee" version 16.0.0.Final from local module loader @275710fc (finder: local module finder @525f1e4e (roots: [...]/wildfly/modules,[...]/wildfly/modules/system/layers/base))

      For ExecutorService (as expected):

      ModuleClassLoader for Module "deployment.[...].war" from Service Module Loader

      Plain ExecutorService sees exactly the same class loader as normal threads in which HTTP request are processed. In version 14.0 this was also true for ScheduledExecutorService.

      Attachments

        Activity

          People

            istudens@redhat.com Ivo Studensky
            doublep_ Paul Pogonyshev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: