jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <asm...@yahoo.com>
Subject Re: JCS thread safe question.
Date Fri, 23 Jun 2006 18:03:28 GMT
Of course JCS is Thread safe, if you mean that it can
handle multiple threads accessing the same regions at
the same time.  

It doesn't work the way you described, but it is
thread safe.  You won't get a corrupted value for a

As for the memory cache, it is a reference cache.  It
returns references to objects in memory.  It does not
clone the values.  If you are manipulating objects
that are in the cache, any other Thread could get a
reference to that same object.  . ..  It is best to
clone objects that are retrieved from the cache prior
to modifying them or just don't modify objects that
have been put in the cache.


--- emily chen <emilychen_2002@yahoo.com> wrote:

> Hi there,
>   I want to use JCS for my web application, and have
> some thread safe question.
>   Here is scenario: 
>   I have a JCS cache named
> which is used to save the ePIN Batch Report data.
>   Thread 1:
>   1)      Get report data from Cache for key.
>   2)      If not data found in the cache, then lock
> the cache for that key.
>   3)      Get report data from database.
>   4)      Put the report data in cache for key
>   5)      Release lock for that key.
>   Thread 2:
>   1)      Get the data from cache for key.
>   2)      Wait for lock to be released (should have
> max wait time here).
>   3)      Get the data from cache.
>   Does JCS have the above functionality -- lock the
> key of cache?  Or I have to put lock on the key in
> my web application source code?
>   Thank for your help.
>   Lucy 
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls
> to the US (and 30+ countries) for 2�/min or less.

To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org

View raw message