Hi Azeez,

On Thu, Jan 23, 2014 at 11:55 PM, Afkham Azeez <az...@wso2.com> wrote:

> No! TenantAxisUtils is a util. You can't destroy the context there. You
> have no idea at what point that code will be called. The context cleanup,
> if necessary should have been performed by some upstream code.
>
>    got it, then required clean up will be doing at
PassThroughNHttpGetProcessor

>
> On Thu, Jan 23, 2014 at 10:15 PM, Dushan Abeyruwan <dus...@wso2.com>wrote:
>
>> Hi Dev
>>
>> AFAIU we should destroy current context before setup new Tenant domain,
>> but in TenantAxisUtils, seems like we are not cleaning up current context 
>> which
>> leads to throw exception as shown in below [2] shall we do the changes as
>> required WDYT?
>>
>>
>>  private static ConfigurationContext
>>     createTenantConfigurationContext(ConfigurationContext mainConfigCtx,
>>                                      String tenantDomain) throws
>> Exception {
>>         synchronized (tenantDomain.intern()) { // lock based on tenant
>> domain
>>             Map<String, ConfigurationContext> tenantConfigContexts =
>> getTenantConfigurationContexts(mainConfigCtx);
>>              ConfigurationContext tenantConfigCtx =
>> tenantConfigContexts.get(tenantDomain);
>>             if (tenantConfigCtx != null) {
>>                 return tenantConfigCtx;
>>             }
>>             long tenantLoadingStartTime = System.currentTimeMillis();
>>             int tenantId = getTenantId(tenantDomain);
>>             if (tenantId == MultitenantConstants.SUPER_TENANT_ID ||
>>                 tenantId == MultitenantConstants.INVALID_TENANT_ID) {
>>                 throw new Exception("Tenant " + tenantDomain + " does not
>> exist");
>>             }
>>          *   PrivilegedCarbonContext.destroyCurrentContext(); need to be
>> here..*
>>             PrivilegedCarbonContext carbonContext =
>> PrivilegedCarbonContext.getThreadLocalCarbonContext();
>>             carbonContext.setTenantId(tenantId);
>>
>>
>> [2]
>>
>> TID: [0] [ESB] [2014-01-21 12:06:54,005] INFO
>> {org.wso2.carbon.core.deployment.SynchronizeRepositoryRequest} - Updating
>> repo update required parameter
>> {org.wso2.carbon.core.deployment.SynchronizeRepositoryRequest}
>> TID: [0] [ESB] [2014-01-21 12:07:11,420] ERROR
>> {org.wso2.carbon.context.internal.CarbonContextDataHolder} - Trying to set
>> the domain from 3 to 6
>> {org.wso2.carbon.context.internal.CarbonContextDataHolder}
>> java.lang.IllegalStateException: Trying to set the domain from 3 to 6
>> at
>> org.wso2.carbon.context.internal.CarbonContextDataHolder.setTenantId(CarbonContextDataHolder.java:1587)
>> at
>> org.wso2.carbon.context.PrivilegedCarbonContext.setTenantId(PrivilegedCarbonContext.java:208)
>> at
>> org.wso2.carbon.context.PrivilegedCarbonContext.setTenantId(PrivilegedCarbonContext.java:197)
>> at
>> org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils.createTenantConfigurationContext(TenantAxisUtils.java:284)
>> at
>> org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils.getTenantConfigurationContext(TenantAxisUtils.java:135)
>> at
>> org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils.getTenantAxisConfiguration(TenantAxisUtils.java:104)
>> at
>> org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils.getAxisService(TenantAxisUtils.java:195)
>> at
>> org.wso2.carbon.transport.nhttp.api.PassThroughNHttpGetProcessor.process(PassThroughNHttpGetProcessor.java:300)
>> at
>> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:155)
>> at
>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>>
>> --
>> Dushan Abeyruwan | Associate Tech Lead
>> Integration Technologies Team
>> PMC Member Apache Synpase
>> WSO2 Inc. http://wso2.com/
>> Blog:http://dushansview.blogspot.com/
>> Mobile:(0094)713942042
>>
>>
>
>
> --
> *Afkham Azeez*
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> * <http://www.apache.org/>*
> *email: **az...@wso2.com* <az...@wso2.com>
> * cell: +94 77 3320919 <%2B94%2077%203320919> blog: *
> *http://blog.afkham.org* <http://blog.afkham.org>
> *twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
> * linked-in: **http://lk.linkedin.com/in/afkhamazeez
> <http://lk.linkedin.com/in/afkhamazeez>*
>
> *Lean . Enterprise . Middleware*
>



-- 
Dushan Abeyruwan | Associate Tech Lead
Integration Technologies Team
PMC Member Apache Synpase
WSO2 Inc. http://wso2.com/
Blog:http://dushansview.blogspot.com/
Mobile:(0094)713942042
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to