Re: ReadWriteLock rather on map's each field than whole map?



On Sep 29, 7:45 pm, easy <easy....@xxxxxxxxx> wrote:
In ConcurrentHashMap.put(...) it uses a lock,
so there is no real "concurrent" put() posible.
right?

No. You haven't sad what kind of lock. You haven' sad what the lock is
used for and when. The lock might protect a few critical section under
special conditions. And francly sad, I do trust the API documentation
more than I trust you. And the API documentation states that the class
supports concurrent updates.

Further, you have stated that the DB access is the time consuming
task. Why are you concerned about a likely very short, if any, write
lock in the map, if the DB access before the write takes "ages"? It
maybe could make a difference when the cache is initially empty. But
only maybe, and once the cache is loaded a write to the map should be
a rare occurrence. If a write is not a rare occurrences than the whole
cache maybe doesn't make sense.

Again, get a good book on Java multi threading. Alternatively refrain
from using multi threading.


.



Relevant Pages

  • Re: Shorts with words on the butt
    ... from which the reader is observing your daughter's butt. ... I'm going to feel sad when we lock her up in another year two ... ... opens teh door gives me a smarl. ...
    (rec.sport.football.college)
  • Re: Patriots | Team agrees to contract with W. Andrews
    ... I suspect he MIGHT have a CHANCE to make the practice squad. ... I think he's a lock, ... As sad as it may sound, ...
    (alt.sports.football.pro.ne-patriots)
  • Re: OT: Anybody Remember This?
    ... > wants to do it" because I think it would have been so sad to see Dick ... It certainly does not mean that we have to lock ... just sort of summarizing with one post what I've read in ... Prev by Date: ...
    (sci.med.transcription)
  • Re: Problem with BDC "View Profile" link
    ... but it seems to "short circuit" while it is reading the BDC cache. ... 71qj High Acquired Read lock on LobSystemInstance cache ... 71qj High Acquired Read lock on MethodInstance cache ... 71qj High Acquired Read lock on TypeDescriptor cache ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: How to free a locked object?
    ... timeout occurred while waiting to lock object xxx' ... Upon checking the v$session_wait, i found "latch: cache ... 'DR','Distributed Recovery', ... 'NA','Library Cache Pin', ...
    (comp.databases.oracle.server)