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. ---Yang >-----Original Message----- >From: David Sean Taylor [mailto:[EMAIL PROTECTED] >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: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
