On Mon, Nov 23, 2009 at 3:31 AM, Emmanuel Lecharny <firstname.lastname@example.org>
when we modify the schema, for instance by adding a new AT, in order not to break the current schema, we apply the modification to a cloned Registries. So far, so good. And if the new registries is ok with the newly added SchemaObject, we swap the registries.
Now, this create a dull issue : all the ServerEntry instances still point to the previous registries, and as we clean the previous registries to avoid memory leaks, all those instances now point to non existing SchemaObjects (more specifically, each instance has attributes which contain a reference to the AttributeType schemaObject they are associated with) !
We cannot hold references to AttributeType or other schema objects anymore. Instead we need to perform a lookup everytime to get these schema objects from the registries via the schema manager. This way when the swap occurs the new objects are extracted every time. No member references should be made to schema objects any longer.
Question : how can we avoid this problem ?
My idea is to apply the modification to the initial registries once it has been proven that the registries alteration leave the Regsitries consistent. We will just clean the cloned registries, and don't swap anymore.
I think this is not a good idea. The swap is a clean approach that does the job just fine. Otherwise if there are sticking points in the registries we will have problems. This is too much to do to solve this issue. Instead we need dynamic look ups of all the schema objects or we need a update pattern to inform of schema changes to swap out these objects.
I am thinking of the Observer or Listener notification patterns here. Otherwise we will have to use dynamic lookups every time which can cost us a lot.
Does it sound good to you, or do you have any better idea ?
No I think we either go with expensive dynamic lookups all over the place or we utilize a update notification mechanism via the Observer or Listener patterns.
Does this sound like a viable alternative?