jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Datta Mane <datta.ma...@gmail.com>
Subject Event handling related Question. Memory Shringker thread
Date Wed, 11 Jan 2012 07:34:29 GMT
This is  scenario I am stuck with

EPG (Electronic programming guide): has data  which is frequently updated

MY WEB APP:  On load calls the EPG Services and load data into JCS cache
After few minutes Say 15 minutes I have to make a call to EPG Service and
get the new Data
*jcs.region.metadataCache.cacheattributes.UseMemoryShrinker=true*
and
jcs.region.metadataCache.elementattributes.IdleTime=120

Based on this documentation
http://commons.apache.org/jcs/apidocs/org/apache/jcs/engine/memory/shrinking/ShrinkerThread.html

My understanding is  when Memory Shrinker Property is set to true and Idle
Time is exceeded
Shrinked thread will remove the Cached Object from memory and invoke
 Eventhandlers handleElementEvent(IElementEvent iElementEvent)

And it does invoke the handleElementEvent(IElementEvent iElementEvent)
So  I put the code below  in handleElementEvent  to load Data
/******************/
                case
IElementEventConstants.ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND:
                    event = (ElementEvent) iElementEvent;
                    element = (CacheElement) event.getSource();
                    //TODO
                loadDataFromEPG("TVGUIDE"); // reload data into Cache
                    break;

/******************/

The issue is Shrinker Thread Calls  handleElementEvent  only for the first
time when the cached exceed Idle time
After reloading When the newly Cached Object exceeds the
ideltime handleElementEvent
is not invoked.

Is this a BUG ?  or Am I doing any thing wrong
How can I resolve this JCS API.

Other option I have  is to use  Quartz Job  to refresh data in Local JCS
cache at specified interval which I want to avoid.

Thanks
Datta

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message