2 Replies Latest reply on Oct 2, 2008 2:03 PM by coralfe

    IOC and thread ignoring create=true and nullifying prev non null value

    coralfe

      I think I have a hole in my understanding of Seams Injection of control.
      Please could someone enlighten me.


      I have acomponent which is also a thread (implements runnable) with an injected component


      @In(create = true)
      private StrategyDataDelegator strategyDataDelegator;



      and then run method calls the following on a regular interval.



      if (strategyDataDelegator!=null) {
          if (versionList==null) {
           versionList = strategyDataDelegator.getLevel(parentBubble.getId());
          } else {...}
      }



      A debug session gets passed the null check and falls over with NPE on strategyDataDelegator two lines later!! HUH!


      It appears as if a user driven event a few moments before has the object injected/created correctly, but nullifies it on exit, so that by the time the (demon) thread gets there, it is nullified.


      I'm very confused.
      Screenshot at debug point here.


      Both components are page scope. Is this the issue? The page is loaded at the time!