[Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Gayashan Amarasinghe
Hi Azeez, During Carbon testing i've created a simple web app that utilize the cache (source code at [1]). In this web app I've created a cache with custom expiry and deployed it in a cluster and hit it using jmeter. During testing i changed the expiry time of the cache prorgrammatically and

Re: [Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Afkham Azeez
You cannot call the builder twice when the cache already exists. Other teams such as IS use both the getCache the builder method with proper synchronization which will return the cache if it exists, or will build return the cache with custom parameter if it does not exist. I will try to write a

Re: [Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Gayashan Amarasinghe
Thanks Azeez. Understood. However in case the developer wanted to change the cache configuration of an existing cache what is the recommended approach? Only possible way would be to make the cache have a different name? On Wed, Oct 29, 2014 at 6:37 PM, Afkham Azeez az...@wso2.com wrote: You

Re: [Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Afkham Azeez
It doesn't happen like that in practice. The developer suddenly doesn't change the mind and change the cache configuration on the fly. These parameters are fixed, and will be set upon cache creation. On Wed, Oct 29, 2014 at 6:15 AM, Gayashan Amarasinghe gayas...@wso2.com wrote: Thanks Azeez.

Re: [Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Gayashan Amarasinghe
Wouldn't it be a valid scenario to change the cache expiry time as in my case? As you've said, I understand that we cannot expect every new version of the app to have cache configuration changes. But during testing or initial development i think it could happen. Even in that case this is not a

Re: [Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Afkham Azeez
If this is the case, you have to deploy a servlet in your webapp which will get initialized when the app is getting deployed, and in the init method of that servlet, you need to call CacheManager.removeCache(cacheName) On Wed, Oct 29, 2014 at 6:28 AM, Gayashan Amarasinghe gayas...@wso2.com wrote:

Re: [Dev] Cache already exists Exception when redeploying a webapp that uses the cache with changes to the cache configurations

2014-10-29 Thread Gayashan Amarasinghe
That makes sense. In such a scenario cache name could be mentioned as a context parameter. Thanks for the clarification! Gayashan Amarasinghe (sent from mobile) On 29 Oct 2014 19:35, Afkham Azeez az...@wso2.com wrote: If this is the case, you have to deploy a servlet in your webapp which