[Glass] how to update models properly

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Thu Oct 30 12:07:20 PDT 2014


Bruno,

If you are using the oop of an object as an id that is shared with other
systems you have to take some care:

  - the oop is tied to the identity of the object so as long as the object
is alive the oop
    doesn't change
  - holding onto an oop does not count as a reference for garbage
collection purposes
    so the object can be gc'ed while the remote reference is being held
somewhere else.
    If this is an issue you can arrange to have an "export set" where you
can put the objects
    while they are being referenced...of course you now have the issue of
managing objects
    in your export set ...
 - when an object is gc'ed the oop itself will possibly be reused for
another object ... so if your
   "export set" leaks you may end up with entirely different objects
showing up in unexpected
   places
 - temporary objects may be assigned oops and assigning an oop does not
make the object
   persistent. Other vms in the system will not be able to access the
temporary objects in
   another vm (unless the temp object is made persistent by reference from
a root object
   and committed). The vm level gc may also collect your temp object, so if
you are using
   the oops of temp objects, you almost certainly have to use an "export
set" to keep them
   alive.

Depending upon your application you may not need to worry about some of
these issues, but using oops as ids for external systems is awfully
convenient so you need to pay close attention to what you are doing with
them ...

Dale

On Thu, Oct 30, 2014 at 11:45 AM, BrunoBB via Glass <
glass at lists.gemtalksystems.com> wrote:

> James,
>
> > The extreme case would be to use the OOP/OID from GemStone as the unique
> > ID
>
> I have a similar case in my application. Some GemStone object are updated
> from a Relational Database (MySQL).
>
> * Once an Object has an OOP it will remain the same until the Object is
> garbage collected ?
> * Or the OOP of an object can change during it's life time ?
>
> In my app each Relational Row is mapped to a Dictionary, and the Object it
> self is never changed but it's instance variables are constantly updated
> with relational data.
>
> If i use the OOP as way to map object with external system we MUST be sure
> that the OPP is allways the same...
>
> Regards,
> Bruno
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/Glass-how-to-update-models-properly-tp4787473p4787663.html
> Sent from the GLASS mailing list archive at Nabble.com.
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20141030/4eb37ddc/attachment.html>


More information about the Glass mailing list