More problems; Statis methods have been added even to StartupFinalizerServiceComponent. SCs are instantiated by the OSGi SCR & we are not supposed to do such things. Perhaps, there are other such badly written code segments, but we must fix those & avoid following bad practices.
Azeez On Thu, Aug 30, 2012 at 8:51 PM, Afkham Azeez <[email protected]> wrote: > There is another issue I see here. We have this Carbon construct called > ListenerManagerRequiredService, and unless all such services become > available, the transports will not be started. This ensures that no > requests will be served by the server until it has properly started up, > because it is in an inconsistent state. This CarbonStartupListener is the > reverse of that. It notifies components that the server has completed start > up & is read for serving requests, which means the server was started while > some components were not properly initialized which can lead to other > problems if people incorrectly start using this API. > > Azeez > > > On Thu, Aug 30, 2012 at 8:46 PM, Afkham Azeez <[email protected]> wrote: > >> Sorry for noticing this mail this late. >> >> On Tue, Aug 21, 2012 at 12:41 AM, Anjana Fernando <[email protected]>wrote: >> >>> Hi, >>> >>> I've added a new interface >>> "org.wso2.carbon.core.init.CarbonStartupListener", and a static method >>> "CarbonServerManager#addCarbonStartupListener(CarbonStartupListener >>> listener)", to get notifications when the Carbon server is fully >>> initialized. This is done from the class >>> "StartupFinalizerServiceComponent", where it keeps the list of registered >>> CarbonStartupListener objects, and at the end of the Carbon server init, >>> all the CarbonStartupListeners are notified. And, if the server is already >>> initialized when a addCarbonStartupListener is called, it will be >>> immediately called back, without it being stored. >>> >> >> Adding such static methods is VERY wrong when you are living within an >> OSGi container. Besides, this is bad OOP . CarbonServerManager is an >> instantiated class, and it is wrong to statically inject objects into such >> classes. The proper way to do this would be through OSGi services. This may >> be working now and make everybody happy temporarily, but we have to design >> & develop our components as much as possible keeping in mind that OSGi >> bundles can be independently stopped & started. All sorts off issues such >> as stale references etc. show up when bad practices like this are followed. >> Please fix this in the proper way, before this API starts to pollute other >> code. >> >> Thanks >> Azeez >> >> >>> This functionality was basically required for the ntask implementation, >>> where the server has to be fully initialized before the scheduled tasks are >>> run, for example, this is a required by BAM tasks and also data services >>> scheduled tasks, where the fully required resources are only available >>> after the Carbon server is fully initialized. >>> >>> The changed code can be found in the following locations: >>> >>> * >>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.0.0/core/org.wso2.carbon.core/4.0.1/src/main/java/org/wso2/carbon/core/init/CarbonServerManager.java >>> * >>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.0.0/core/org.wso2.carbon.core/4.0.1/src/main/java/org/wso2/carbon/core/init/CarbonStartupListener.java >>> * >>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.0.0/core/org.wso2.carbon.core/4.0.1/src/main/java/org/wso2/carbon/core/internal/StartupFinalizerServiceComponent.java >>> >>> And the usage of the above functionality in ntask can be found at: >>> >>> * >>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/ntask/org.wso2.carbon.ntask.core/4.0.1/src/main/java/org/wso2/carbon/ntask/core/service/impl/TaskServiceImpl.java >>> >>> Cheers, >>> Anjana. >>> -- >>> *Anjana Fernando* >>> Associate Technical Lead >>> WSO2 Inc. | http://wso2.com >>> lean . enterprise . middleware >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> 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: **[email protected]* <[email protected]>* cell: +94 77 3320919 >> 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* >> >> * >> * >> *Lean . Enterprise . Middleware* >> >> > > > -- > *Afkham Azeez* > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > * <http://www.apache.org/>** > email: **[email protected]* <[email protected]>* cell: +94 77 3320919 > 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* > * > * > *Lean . Enterprise . Middleware* > > -- *Afkham Azeez* Director of Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>** email: **[email protected]* <[email protected]>* cell: +94 77 3320919 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* * * *Lean . Enterprise . Middleware*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
