5 Replies Latest reply on Aug 16, 2007 2:51 PM by cf_dev2

    ObjectFatory X Race Condition


      I have a class with some public properties.

      To avoid too many create objects I tried to create some object models in the application scope,

      application.objProduct = createObject("component","Product").init();

      So I started using:

      variables.objProduct = application.objProduct
      variables.objProduct.load( id );

      insted of

      variables.objProduct = createObject("component","Product");
      variables.objProduct.load( id );

      After that I´ve had many problems with race conditions.
      It seems when I create an object using "objProduct = application.objProduct"
      the variable (objProduct) is created per reference and every execution of the
      load() method populates the same object (application.objProduct) instead of
      the local variables.objProduct.

      So I like to know how to create local objects without getting the objects parent reference.

      If I use a get method like "variables.objProduct = application.objProduct.get();"
      intead of simple attribution "variables.objProduct = application.objProduct"
      would solve the race condition problem?

      I know the ObjectFactory concepts would solve the problem, but these application
      doesn´t have only private properties, but public properties, too.

      Af first I need to solve the problem 1: race condition.
      After that I´ll make some tests with ObjectFatories.