Uploaded image for project: 'Errai'
  1. Errai
  2. ERRAI-617

Dynamically looking up beans in @AfterInitialization methods causes a concurrent modification exception

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2.4.0.Final
    • Component/s: None
    • Labels:
      None

      Description

      Can be reproduced with the following code, don't know if this is proper use. It's done this way because SampleClass is dynamic, workaround is putting this lookup code in @PostConstruct

      @EntryPoint
      public class SampleEntryPoint {

      private Logger log = Logger.getLogger(getClass().getName());

      @PostConstruct
      public void afterConstruct() {
      }

      @AfterInitialization
      public void loadApplication()

      { log.info("@AfterInitialisation inside SampleEntryPoint"); SampleClass inst = IOC.getBeanManager().lookupBean(SampleClass.class).getInstance(); log.info("SomeClass getInstance is: " + inst); }

      }

      @Dependent
      public class SampleClass {

      private Logger log = Logger.getLogger(getClass().getName());

      @AfterInitialization
      public void afterInit()

      { log.info("@AfterInitialisation inside SomeClass"); }

      }

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                edewit Erik Jan de Wit
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: