portals-jetspeed-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sie, Yang" <yang....@fmr.com>
Subject RE: Jetspeed Cache Question
Date Mon, 05 Nov 2007 21:30:53 GMT
I had my page loaded with data, my portlet sizes and my other personal
data are correctly displayed, they were all from preferences. So I
thought my preferences would be loaded by then. I just now went to edit
to change some preference, and then run that section of code again, it
again returned me all zeros. 

Thank you.


>-----Original Message-----
>From: David Sean Taylor [mailto:david@bluesunrise.com] 
>Sent: Monday, November 05, 2007 4:17 PM
>To: Jetspeed Users List
>Subject: Re: Jetspeed Cache Question
>On Nov 5, 2007, at 12:27 PM, Sie, Yang wrote:
>> Hello all:
>> I am trying to monitor memory consumption for all cache objects in
>> Jetspeed. This is what I did and for some reason that memoryStoreSize
>> and calculateInMemorySize gave me zero.
>> This is what I did basically by using EhCache API:
>> import net.sf.ehcache.Cache;
>> import net.sf.ehcache.CacheManager;
>> CacheManager ehCacheManager=CacheManager.getInstance();
>> String[] cacheNames=ehCacheManager.getCacheNames();
>> I looped thru the names and get 6 cache object names (which matches  
>> what
>> defined in ehcache.xml)
>> preferencesCache
>> portletApplicationNameCache
>> portletDefinitionOidCache
>> portletDefinitionNameCache
>> portletApplicationOidCache
>> portletContentCache
>> Then I used following
>>  Cache thisCache=ehCacheManager.getCache(aCacheName);
>>  long mss=thisCache.getMemoryStoreSize();
>This API returns the number of elements in the memory store.
>Could it be possible that we haven't loaded any prefs yet at 
>this point?
>>  long ims=thisCache.calculateInMemorySize();
>    This call gets the size of the memory store for this cache.  
>Perhaps if its not yet in use, it returns 0.
>According to the javadocs:
>     Warning: This method can be very expensive to run. Allow  
>approximately 1 second per 1MB of entries.
>    Running this method could create liveness problems because the  
>object lock is held for a long period
>     Returns:
>         the approximate size of the memory store in bytes
>To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>For additional commands, e-mail: jetspeed-user-help@portals.apache.org

To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org

View raw message