Hi,

I have an Admin Service which accesses a method in an already available
osgi service.
I am using the following code segment to achieve this.

PrivilegedCarbonContext.startTenantFlow();
Object service =
PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(AnalyticsDataAPI.class);
if(service instanceof AnalyticsDataAPI) {
    this.analyticsDataAPI = (AnalyticsDataAPI) service;
}

I need to know whether there is any better way of achieving this.

Thanks.
Regards,
Dilhasha
-- 
Fathima Dilhasha
*Software Engineer*
Mobile : +94 (0) 771663314 <%2B94%20%280%29%20773655496>
<%2B94%20%280%29%20773%20451194>
dilha...@wso2.com <madha...@wso2.com>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to