Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3691

BackgroundProcess should use a java.util.concurrent.Executor alternatively to spawning a new thread

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.3.1
    • 6.1.1
    • Core Interceptors
    • None

    Description

      Every new instance of org.apache.struts2.interceptor.BackgroundProcess spawns a new Thread (see constructor), no thread pooling is used.

      Besides problems in environments where some container might need to manage the creation of threads, this issue also prevents certain performance/efficiency optimizations via ThreadLocal from taking full effect. E.g.: We use ThreadLocals for Random and SimpleDateFormat and those thread local instances "are lost" when a new Thread is created.

      Therefore BackgroundProcess should be given a new constructor that takes a java.util.concurrent.Executor instance that is used to execute the Runnable.

      Attachments

        1. WW-3691.patch
          5 kB
          Lukasz Lenart
        2. WW-3691_core.txt
          5 kB
          Falko Modler
        3. WW-3691_showcase.txt
          3 kB
          Falko Modler

        Activity

          People

            lukaszlenart Lukasz Lenart
            famod Falko Modler
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m