commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerhard Froehlich" <g-froehl...@gmx.de>
Subject RE: [simplestore] inital check in
Date Mon, 14 Jan 2002 18:40:44 GMT
Juozas

>-----Original Message-----
>From: Juozas Baliuka [mailto:baliuka@mwm.lt]
>Sent: Monday, January 14, 2002 8:20 PM
>To: Jakarta Commons Developers List
>Subject: RE: [simplestore] inital check in
>
>
>Hi,
>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 :
>WRITE:
>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.
>READ:
>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" :)

Kool, mate. How about a MRU based Memory Store which is implemented with
week reference. We can call it SoftMRUMemoryStore or something else. Just
send compilable code and I will check it in for you. Keep sending patches,
it's valuable ;-).

Stand by for patches 

  Gerhard

>At 05:28 PM 1/14/2002 +0100, you wrote:
>>Juozas,
>>
>> >From: Juozas Baliuka [mailto:baliuka@mwm.lt]
>> >
>> >>
>> >>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:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message