commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerhard Froehlich" <gerhard_froehl...@at.ibm.com>
Subject RE: [simplestore] inital check in
Date Tue, 15 Jan 2002 12:09:30 GMT

Hi Juozas,
do you have interest to move your implemenation to my simplestore
package?
The only thing you have to do, is to replace your Store interface with
my Store interface.

I identify two objects we can need:
- your MemoryStore, maybe it needs a new name.
- your SynchronizedStore, that can we use for all our Stores.

It would be kool to have it!

What do you think?

Greets

   Gerhard




                                                                                         
                         
                    Juozas Baliuka                                                       
                         
                    <baliuka@mwm.l       To:     "Jakarta Commons Developers List"    
                            
                    t>                    <commons-dev@jakarta.apache.org>      
                                  
                                         cc:                                             
                         
                    15.01.2002           Subject:     RE: [simplestore] inital check in  
                         
                    13:46                                                                
                         
                    Please respond                                                       
                         
                    to "Jakarta                                                          
                         
                    Commons                                                              
                         
                    Developers                                                           
                         
                    List"                                                                
                         
                                                                                         
                         
                                                                                         
                         




Hi,
This is cache implementation, it will not work if key has strong referense
on value (or have bugs).
There is a very simple test in MemoryStore main method.
I send a correct implementation for SoftReferenceMap in commons collections
a month ago, but it was forgot.
It is possible to implement cache with Map interface and memory store can
wrap this map (it will be more useful). Is it interesting for anybody ?

output from test :

operations ...
1 removed from queue, size7
2 removed from queue, size15
3 removed from queue, size14
4 removed from queue, size13
5 removed from queue, size12
6 removed from queue, size11
7 removed from queue, size10
8 removed from queue, size9
9 removed from queue, size8
10 removed from queue, size7
11 removed from queue, size15
12 removed from queue, size14
13 removed from queue, size13
14 removed from queue, size12
15 removed from queue, size11
16 removed from queue, size10
17 removed from queue, size9
18 removed from queue, size8
19 removed from queue, size7
23 removed from queue, size15
24 removed from queue, size14
25 removed from queue, size13
26 removed from queue, size12
27 removed from queue, size11
28 removed from queue, size10
20 removed from queue, size9
21 removed from queue, size8
22 removed from queue, size7
29 removed from queue, size15
30 removed from queue, size14
31 removed from queue, size13
32 removed from queue, size12
33 removed from queue, size11
34 removed from queue, size10
35 removed from queue, size9
36 removed from queue, size8
37 removed from queue, size7
46 removed from queue, size15
38 removed from queue, size14
39 removed from queue, size13
40 removed from queue, size12
41 removed from queue, size11
42 removed from queue, size10
43 removed from queue, size9
44 removed from queue, size8
45 removed from queue, size7
47 removed from queue, size15
48 removed from queue, size14
49 removed from queue, size13
50 removed from queue, size12
51 removed from queue, size11
52 removed from queue, size10
53 removed from queue, size9
54 removed from queue, size8
55 removed from queue, size7
56 removed from queue, size15
57 removed from queue, size14
58 removed from queue, size13
59 removed from queue, size12
60 removed from queue, size11
61 removed from queue, size10
62 removed from queue, size9
63 removed from queue, size8
64 removed from queue, size7
69 removed from queue, size15
70 removed from queue, size14
71 removed from queue, size13
72 removed from queue, size12
73 removed from queue, size11
65 removed from queue, size10
66 removed from queue, size9
67 removed from queue, size8
68 removed from queue, size7
74 removed from queue, size15
75 removed from queue, size14
76 removed from queue, size13
77 removed from queue, size12
78 removed from queue, size11
79 removed from queue, size10
80 removed from queue, size9
81 removed from queue, size8
82 removed from queue, size7
83 removed from queue, size15
84 removed from queue, size14
85 removed from queue, size13
86 removed from queue, size12
87 removed from queue, size11
88 removed from queue, size10
89 removed from queue, size9
90 removed from queue, size8
91 removed from queue, size7
92 removed from queue, size15
93 removed from queue, size14
94 removed from queue, size13
95 removed from queue, size12
96 removed from queue, size11
97 removed from queue, size10
98 removed from queue, size9
99 removed from queue, size8
100 removed from queue, size7
101 removed from queue, size15
102 removed from queue, size14
103 removed from queue, size13
104 removed from queue, size12
105 removed from queue, size11
106 removed from queue, size10
107 removed from queue, size9
108 removed from queue, size8
109 removed from queue, size7
115 removed from queue, size15
116 removed from queue, size14
117 removed from queue, size13
118 removed from queue, size12
110 removed from queue, size11
111 removed from queue, size10
112 removed from queue, size9
113 removed from queue, size8
114 removed from queue, size7
119 removed from queue, size15
120 removed from queue, size14
121 removed from queue, size13
122 removed from queue, size12
123 removed from queue, size11
124 removed from queue, size10
125 removed from queue, size9
126 removed from queue, size8
127 removed from queue, size7
128 removed from queue, size15
129 removed from queue, size14
130 removed from queue, size13
131 removed from queue, size12
132 removed from queue, size11
133 removed from queue, size10
134 removed from queue, size9
135 removed from queue, size8
136 removed from queue, size7
138 removed from queue, size15
139 removed from queue, size14
140 removed from queue, size13
141 removed from queue, size12
142 removed from queue, size11
143 removed from queue, size10
144 removed from queue, size9
145 removed from queue, size8
137 removed from queue, size7
146 removed from queue, size15
147 removed from queue, size14
148 removed from queue, size13
149 removed from queue, size12
150 removed from queue, size11
151 removed from queue, size10
152 removed from queue, size9
153 removed from queue, size8
154 removed from queue, size7
161 removed from queue, size15
162 removed from queue, size14
163 removed from queue, size13
155 removed from queue, size12
156 removed from queue, size11
157 removed from queue, size10
158 removed from queue, size9
159 removed from queue, size8
160 removed from queue, size7
164 removed from queue, size15
165 removed from queue, size14
166 removed from queue, size13
167 removed from queue, size12
168 removed from queue, size11
169 removed from queue, size10
170 removed from queue, size9
171 removed from queue, size8
172 removed from queue, size7
173 removed from queue, size15
174 removed from queue, size14
175 removed from queue, size13
176 removed from queue, size12
177 removed from queue, size11
178 removed from queue, size10
179 removed from queue, size9
180 removed from queue, size8
181 removed from queue, size7
184 removed from queue, size15
185 removed from queue, size14
186 removed from queue, size13
187 removed from queue, size12
188 removed from queue, size11
189 removed from queue, size10
190 removed from queue, size9
182 removed from queue, size8
183 removed from queue, size7
191 removed from queue, size15
192 removed from queue, size14
193 removed from queue, size13
194 removed from queue, size12
195 removed from queue, size11
196 removed from queue, size10
197 removed from queue, size9
198 removed from queue, size8
199 removed from queue, size7
207 removed from queue, size15
208 removed from queue, size14
200 removed from queue, size13
201 removed from queue, size12
202 removed from queue, size11
203 removed from queue, size10
204 removed from queue, size9
205 removed from queue, size8
206 removed from queue, size7
209 removed from queue, size15
210 removed from queue, size14
211 removed from queue, size13
212 removed from queue, size12
213 removed from queue, size11
214 removed from queue, size10
215 removed from queue, size9
216 removed from queue, size8
217 removed from queue, size7
218 removed from queue, size15
219 removed from queue, size14
220 removed from queue, size13
221 removed from queue, size12
222 removed from queue, size11
223 removed from queue, size10
224 removed from queue, size9
225 removed from queue, size8
226 removed from queue, size7
230 removed from queue, size15
231 removed from queue, size14
232 removed from queue, size13
233 removed from queue, size12
234 removed from queue, size11
235 removed from queue, size10
227 removed from queue, size9
228 removed from queue, size8
229 removed from queue, size7
236 removed from queue, size15
237 removed from queue, size14
238 removed from queue, size13
239 removed from queue, size12
240 removed from queue, size11
241 removed from queue, size10
242 removed from queue, size9
243 removed from queue, size8
244 removed from queue, size7
iterating cache ...
252
251
250
249
248
247
246
245
254
253
0
At 07:40 PM 1/14/2002 +0100, you wrote:
>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>









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

#### SynchronizedStore.java has been removed from this note on January 15
2002 by Gerhard Froehlich
#### MemoryStore.java has been removed from this note on January 15 2002 by
Gerhard Froehlich
#### ObjectNotFoundException.java has been removed from this note on
January 15 2002 by Gerhard Froehlich
#### Store.java has been removed from this note on January 15 2002 by
Gerhard Froehlich
#### StoreException.java has been removed from this note on January 15 2002
by Gerhard Froehlich
#### DublicateKeyException.java has been removed from this note on January
15 2002 by Gerhard Froehlich




--
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