Hi All,
Ok, so I was just trying to add some functionality to a torque generated
class that would allow it to be scheduled for deletion (from the
database), but that the actual deleting would only take place when the
objects finalize() method was called.
I have a delete method set up on XXXPeer which works fine and a finalize
method on XXX object itself like this:
public void finalize()
{
if(this.getDelete() == Boolean.TRUE)
{
try{
KeywordPeer.delete(this);
}catch(Exception e)
{
o_cat.info("Failure during attempt to delete keyword: " +
getKeyword() + " as part of gc");
o_cat.info(e);
}
}
}
public Boolean getDelete()
{
return o_delete;
}
Now I've tried this with booleans, Boolean objects strings. Whatever I
use to indicate that the object is ready to be deleted ends up not being
set properly in the finalize method.
What I mean is that I can call a method to set the o_delete object to
FALSE, and I can check that it has taken place, but when the finalize
method is called the o_delete object shows up as TRUE, or rather as
whatever value it was set to when the XXX object was initialized. I've
checked the object ids themselves and I get output like this:
DEBUG [main] (Keyword.java:271) - object is com.neurogrid.om.Keyword@2454
DEBUG [main] (Keyword.java:272) - Delete is false
DEBUG [main] (Keyword.java:273) - Setting delete to true
DEBUG [main] (Keyword.java:274) - Delete is true
DEBUG [main] (Keyword.java:275) - object is com.neurogrid.om.Keyword@2454
INFO [main] (Keyword.java:280) - Calling GC
INFO [Finalizer] (Keyword.java:220) - keyword ernie finalize being called
INFO [Finalizer] (Keyword.java:221) - object com.neurogrid.om.Keyword@2454
INFO [Finalizer] (Keyword.java:227) - keyword ernie scheduled for
delete: false
Can anyone think why the same object (as indicated by the identifier
"com.neurogrid.om.Keyword@2454") should have had a private variable
switched back to its initial state when it gets called by the GC?
Thanks in advance.
CHEERS> SAM
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>