Re: [Patsystem-users] what about object deletion?
Brought to you by:
nthx
|
From: Tomasz N. <Tom...@ii...> - 2005-06-24 20:41:21
|
On the next beautiful day: Fri, 24 June, 2005, Vladimir Atehort=FAa wrote= : > Hi. >=20 > I've been re-checking the source, and it seems business objects never g= et garbage collected, mainly because the identity map holds strong refere= nces to them. For my primary app I just don't care about the problem. Persisteble interface of the root object provides the funcionality. I've never used it however. (where was YAGNI at the moment? ;) ) > =BFhow does PAT handle the "old objects eat all ram" issue? PAT doesn't. You can. Just write on OID down, and use ((org.nthx.pat.Persisteble)root).removeBO(oid); in the appropriate moment.. > I can only think of the obvious solution, which is using a Soft HashMap= instead of a regular hashmap. > Sun's provided weakhashmap wouldnt work because it holds weak refferenc= es to keys, and PAT needs weak refferences to values. I was looking at WeakHashMap, but it isn't serializable (I don't know if making it Serializable would cause sth extra..), and second: I'm not sure how exactly does it work when (de)serializing such IdentityMap. If you have some experience on that, share it here. Here is example on the problem I just can't solve.. I'm not sure how all weak hashMaps solve following problem: Map consists of two 4 keys-values: 1 -> root (we need to keep that object) 2 -> root.child 3 -> other (this should be garbage collected soon) 4 -> other.andHisChild 'root' is our ROOT. Object 2 is referenced by root and stored in IM (IdentityMap). Object 3 however, is stored in IM (cause it was created) but is not referenced by anyone and should be removed in the next session. So we close application, take snapshot, open application, and what will happen? How can any weak hashMap recognize to remove 'other' (among with his children) and not 'root' (with children)?=20 There are no references to OID: 1 and OID: 3. I think there might be some tricky hack to that. I just didn't have time and didn't care. If you really need this we can think of it. I would be happy to see the solution and apply it to PAT. Want to contribute? :) > Regards, > Vladimir Best regards, Tomasz --=20 _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |