Niclas Hedhman wrote: > On Tue, Mar 10, 2009 at 12:39 PM, Rickard Öberg <[email protected]> > wrote: > >> The main problem I see with this is that the UoW would be longrunning, >> and since it holds strong references to EntityState/EntityInstances it >> will cause memory leaks. This *could* be fixed by using WeakReferences >> in the UoW caches but I'm not entirely sure of the consequences of this. > > Somehow it feels "right", and the memory leak problem is possibly just > a caching strategy issue...
I've been playing with both strategies today, and if there is one UoW per event, then any references you get are immediately invalid, and you have to dereference() them, and it becomes quite tricky after a while. Yes, I think that it might easily resolved by having a caching strategy in the UoW. In the Usecase one would specify that the cache is weak, so that if there is state in the UoW which is not 1) created 2) removed 3) updated, then it is ok to have a weak reference to it. Then all is fine! > Having a CachingEntityStore is of course another choice. In either > case, don't you need to look at how to deal with cross-JVM > synchronizations as well? Yes, but that is another headache. I will probably just have a manual "refresh" button for now, but more automatic options are interesting as well. /Rickard _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

