commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juozas Baliuka <>
Subject RE: [simplestore] inital check in
Date Mon, 14 Jan 2002 19:20:15 GMT
I read documentation tested all Reference types today.
The problem exists, object is cleared before reference is queued.
There is no way to flush expired object to stable storage if it has no 
strong references,
but you can solve it this way :
0. Test queue, clear pooled references.
1. write object .
2. Add internal strong and Weak reference, make it a "new".
3. Put weak reference to cache.
4. release strong internal references from "old" objects.
0. Test queue, clear pooled references.
1. Search in Cashe.
2. Load object, if  not found.
3. Add internal strong and Weak references, make object a "new".
4. Put weak reference to Cashe.
5. Release strong internal references from "old" objects.
6. return object.

No need for "background cleanup".
I can implement this kind of cache, if it interesting for some body.
I have some my cache implementations, but they are not very "common" :)

At 05:28 PM 1/14/2002 +0100, you wrote:
> >From: Juozas Baliuka []
> >
> >>
> >>StoreJanitorImpl: you can register your Memory Stores in
> >>this class. A background Thread checks if memory running
> >>slow in you JVM and if yes it frees some objects out of the
> >>registered Stores.
> >
> >Hi,
> >I think it is better to use java.lang.ref.* to solve problems related to
> >memory management.
> >Application threads are not permitted  in EJB container and I believe GC
> >will do it better.
> >
> >It is from JDK documentation :
> >"Soft reference objects, which are cleared at the discretion of the garbage
> >collector in response to memory demand. Soft references are most often used
> >to implement memory-sensitive caches. "
>Aha, it's a shame but I never looked into this. But I do it right now!
>Does anybody(you) have experiences with this soft references and
>how to use them?
>Yes I know RTFM ;-)!
>   Gerhard
>"A man with one watch knows what time it is,
>a man with two watches is never sure...
>(Albert Einstein)"
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message