Yeah feedback!  What you are looking at is the initial implementation 
(so no weak references yet). I will try and answer your question ... but 
i will also point you to the code examples in javadocs, and on the wiki 
page.
- 
http://docs.codehaus.org/display/GEOTDOC/09+Collection+Classes#09CollectionClasses-ObjectCache
> Just a few note that popup from my mind:
> * Shouldn't DefaultObjectCache and ObjectCacheEntry be package-privates?
>   
The should be.
> * ObjectCacheEntry.lock doesn't need to be volatile, since the field
>    is never modified (it can be final). Unless I'm missing something,
>    "volatile" just add overhead in this context.
>   
final is correct.
> * In DefaultObjectCache, the following lines are not really consistent:
>
>    cache = Collections.synchronizedMap(new HashMap()); // Line 45
>
>    synchronized (cache) { ...}   // Line 131
>   
ha ha - too true.
>    Because Collections.synchonizedMap doesn't use 'cache' as the lock.
>    It use a private lock instead. It may be better to not use
>    Collections.synchronizedMap(...) and uses 'synchronized (cache)'
>    explicitly where needed.
>   
I see your point - especially for where we want to retrive a "entry" in 
one automic operation (creating it if needed).
> * I'm not sure to understand the intend of various 'test(...)'
>    methods? (especially the difference compared to 'get(...)'
>    is not clear to me).
>   
get uses the read lock
test uses the write lock

We are looking at the specific read/write lock used - if we choose the 
right one a writer (ie a thread that has performed a writeLock( key ) 
call) may also be able to enter the get method as well ...

So the test method may be removed if we can choose our implementation 
correctly.
> How do we process if I would like to perform some edition in the code that do 
> not impact functionality (e.g. factor out some redundant method calls)? 
> Should I 
> wait that your project is more advanced in order to avoid to disturb?
>   
Please wait until tomorrow - I am hooking the beast up right now (being 
very careful to leave existing classes alone). Indeed we could chat on 
IRC tomorrow and just do a general catch up on where we are at?

Jody

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to