Re: [mdr-users] custom implementation recycling?

SainTiss <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Hi,

Hmm, is this an "undocumented feature"? I can't seem to find any information on this... Is there any?

Still, it seems to work, so thanks :)

Also, since I read you recently became a father, congratulations :)

Kind Regards,

Hans

On Tue, 14 Jun 2005 16:22:05 +0200
Martin Matula <[email protected]> wrote:

> SainTiss wrote:
> 
> >Apparently, it's got more to do with garbage collection being handled differently on different systems, instead of different JDK's as I erroneously thought...
> >
> >Point is, I was trying to add an attribute to the custom implementation, which is not present in the MOF model... So obviously I would need the same custom implementation be associated with the same JMI object all the time, otherwise the value of my additional attribute wouldn't be preserved...
> >
> >Unfortunately, it seems that these custom implementation wrappers can be garbage collected when there is no reference to them or their wrapped JMI object in scope. If I keep a reference to the custom implementation wrapper, then it seems like the JMI object is assigned the same wrapper if it's fetched from MDR later on... But I'm not sure if I can count on that... 
> >
> Yes, you can count on that. This is how it works.
> 
> >Also, keeping references to these wrappers isn't the most pretty solution...
> >
> >Is there a solution/workaround here?
> >  
> >
> A better solution would be to use getSlotX()/setSlotX() methods in the 
> underlying storable object to store the value of the additional 
> attribute - this way you can be sure the value is persisted with the 
> values of other modeled attributes.
> Your custom impl. code could look like this:
> 
> public void setAttribute(String value) {
>     _getDelegate().setSlot1(value);
> }
> 
> public String getAttribute() {
>     return (String) _getDelegate().getSlot1();
> }
> 
> Regards,
> Martin
> 


-- 
Hans Schippers
Research Assistant of the Research Foundation - Flanders (FWO - Vlaanderen)
http://www.win.ua.ac.be/~hschipp/
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.