+1 to remove or redirect the getCurrentContext() method. I think we are
hitting issues from time to time due to calling getCurrentContext() and it
is not easy to debug issues coming due to this.

Thanks,
Lasantha

On 17 November 2014 20:13, Danushka Fernando <danush...@wso2.com> wrote:

> IMO removing is better rather than adding another layer.
>
> Thanks & Regards
> Danushka Fernando
> Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> On Mon, Nov 17, 2014 at 5:48 PM, Afkham Azeez <az...@wso2.com> wrote:
>
>> As part of Carbon 4.3, shall we remove the getCurrentContext method, or
>> simply call getThreadLocalCarbonContext from the getCurrentContext method?
>> It will get rid of a lot of confusion.
>>
>> On Mon, Nov 17, 2014 at 3:45 PM, Lahiru Chandima <lahi...@wso2.com>
>> wrote:
>>
>>> Thanks everyone for the help.
>>>
>>> Found the error that prevented already existing artifacts in a tenant
>>> from getting deployed when tenant is loaded.
>>>
>>> Actually, deploy() method in deployer had been getting called on the
>>> tenant loadup even though I didn't notice.
>>>
>>> But, I had used
>>> PrivilegedCarbonContext.getCurrentContext().getTenantId() to get the tenant
>>> id. This returns -1234 when the artifacts are deployed for the first time
>>> when the tenant is loaded. So in deploy() method, created artifact is added
>>> to the super tenant.
>>>
>>> Found that getCurrentContext() shouldn't be used and
>>> getThreadLocalCarbonContext() should be used instead. When
>>> getThreadLocalCarbonContext() is used, problem got resolved.
>>>
>>> Thanks
>>>
>>> On Sat, Nov 15, 2014 at 5:52 PM, Afkham Azeez <az...@wso2.com> wrote:
>>>
>>>> Tenants are lazy loaded. Tenants mainly get loaded only if a request
>>>> for that tenant was received, and after 15 minutes of inactivity, the
>>>> tenant will get unloaded again. When a tenant is not loaded, its deployers
>>>> will not get triggered.
>>>>
>>>> On Sat, Nov 15, 2014 at 12:20 PM, Lahiru Chandima <lahi...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi Frizhan,
>>>>>
>>>>> Thanks for the information.
>>>>>
>>>>> Is there any way I can automatically re-deploy artifacts for tenants
>>>>> on startup? If I log in using a tenant user to ESB, I can see the proxy
>>>>> service artifacts that were added earlier, showing that they were somehow
>>>>> re-deployed. So I think there should be a way.
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Sat, Nov 15, 2014 at 10:31 AM, Firzhan Naqash <firz...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Lahiru,
>>>>>>
>>>>>> Deployer's deploy() method will get trigger only when artifacts are
>>>>>> being deployed.
>>>>>>
>>>>>> For super-tenant during the server start-up axis2 re-deploys the
>>>>>> artifacts, thus triggering deploy(). But for tenants nothing happens like
>>>>>> that unless you do it manually.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>> Firzhan
>>>>>>
>>>>>> On Sat, Nov 15, 2014 at 7:33 AM, Lahiru Chandima <lahi...@wso2.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Lasantha,
>>>>>>>
>>>>>>> Thanks for the solution.
>>>>>>>
>>>>>>> logging in as a tenant user solved the problem. Now new artifacts
>>>>>>> that I add after tenant is loaded get deployed.
>>>>>>>
>>>>>>> But, the artifacts that were already there in my tenant artifact
>>>>>>> directory neither gets deployed at server startup nor when a tenant 
>>>>>>> user is
>>>>>>> logged in. But these artifacts get deployed if I do some change to them
>>>>>>> after a tenant user logs in.
>>>>>>>
>>>>>>> What may be the reason for this?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Nov 15, 2014 at 12:08 AM, Lasantha Fernando <
>>>>>>> lasan...@wso2.com> wrote:
>>>>>>>
>>>>>>>> Hi Lahiru,
>>>>>>>>
>>>>>>>> Can you verify whether your tenant is loaded in the server? (If you
>>>>>>>> simply login as a tenant user, the tenant should be loaded)
>>>>>>>>
>>>>>>>> If your tenant is not loaded, the deployment of artifacts for that
>>>>>>>> particular tenant will not happen. AFAIK, this is the expected 
>>>>>>>> behaviour
>>>>>>>> for a carbon server since we load tenants lazily.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Lasantha
>>>>>>>>
>>>>>>>> On 14 November 2014 22:58, Lahiru Chandima <lahi...@wso2.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi Firzhan,
>>>>>>>>>
>>>>>>>>> Thanks for the reply.
>>>>>>>>>
>>>>>>>>> Tried your method and its working for files deployed in
>>>>>>>>> repository/deployment/server/event-sinks. But still no luck with 
>>>>>>>>> deploying
>>>>>>>>> for a tenant (in repository/tenants/1/event-sinks)
>>>>>>>>>
>>>>>>>>> Any idea why?
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> On Fri, Nov 14, 2014 at 8:10 PM, Firzhan Naqash <firz...@wso2.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Lahiru,
>>>>>>>>>>
>>>>>>>>>> Rathern than defining them in axis2.xml, you can define them in
>>>>>>>>>> compnent.xml and pom.xml file which worked for me [1]
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>> http://architects.dzone.com/articles/writing-axis2-custom-deployers
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Firzhan
>>>>>>>>>>
>>>>>>>>>> On Fri, Nov 14, 2014 at 7:14 PM, Lahiru Chandima <
>>>>>>>>>> lahi...@wso2.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi All,
>>>>>>>>>>>
>>>>>>>>>>> I have created an Axis2 deployer to deploy an xml artifact. I
>>>>>>>>>>> have added following to repository/conf/axis2/axis2.xml
>>>>>>>>>>>
>>>>>>>>>>> <deployer extension=".xml"
>>>>>>>>>>> class="org.wso2.carbon.event.sink.EventSinkDeployer"
>>>>>>>>>>> directory="event-sinks"/>
>>>>>>>>>>>
>>>>>>>>>>> And I have created a directory named event-sinks for my new
>>>>>>>>>>> artifact type in repository/deployment/server
>>>>>>>>>>>
>>>>>>>>>>> When I add a new xml artifact to the event-sinks directory,
>>>>>>>>>>> deploy(DeploymentFileData deploymentFileData) in my deployer gets 
>>>>>>>>>>> called
>>>>>>>>>>> without a problem.
>>>>>>>>>>>
>>>>>>>>>>> But, if I deploy an artifact for a tenant (eg: in directory
>>>>>>>>>>> repository/tenants/1/event-sinks for tenant 1), deploy() method of 
>>>>>>>>>>> my
>>>>>>>>>>> deployer doesn't get called.
>>>>>>>>>>>
>>>>>>>>>>> What have I done wrong? Have I created event-sinks directory in
>>>>>>>>>>> the wrong location for tenant 1?
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Lahiru Chandima
>>>>>>>>>>> *Senior Software Engineer*
>>>>>>>>>>> Mobile : +94 (0) 772 253283
>>>>>>>>>>> lahi...@wso2.com
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Dev mailing list
>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Lahiru Chandima
>>>>>>>>> *Senior Software Engineer*
>>>>>>>>> Mobile : +94 (0) 772 253283
>>>>>>>>> lahi...@wso2.com
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Dev mailing list
>>>>>>>>> Dev@wso2.org
>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Lasantha Fernando*
>>>>>>>> Software Engineer - Data Technologies Team
>>>>>>>> WSO2 Inc. http://wso2.com
>>>>>>>>
>>>>>>>> email: lasan...@wso2.com
>>>>>>>> mobile: (+94) 71 5247551
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Lahiru Chandima
>>>>>>> *Senior Software Engineer*
>>>>>>> Mobile : +94 (0) 772 253283
>>>>>>> lahi...@wso2.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lahiru Chandima
>>>>> *Senior Software Engineer*
>>>>> Mobile : +94 (0) 772 253283
>>>>> lahi...@wso2.com
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *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*
>>>>
>>>
>>>
>>>
>>> --
>>> Lahiru Chandima
>>> *Senior Software Engineer*
>>> Mobile : +94 (0) 772 253283
>>> lahi...@wso2.com
>>>
>>
>>
>>
>> --
>> *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*
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Lasantha Fernando*
Software Engineer - Data Technologies Team
WSO2 Inc. http://wso2.com

email: lasan...@wso2.com
mobile: (+94) 71 5247551
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to