i have a requirement where i need to reload my osgi bundles 4 times a day . Reloading a bundle means recreating static instance Beans , reloading camel routes , recreating and injecting thread pools ,database connection pools ..etc(other spring xml stuff) . I tried to refresh my bundles through ssh but i needed bundle id's for that which can change overtime . So , i wrote a Manager Bundle which gets the bundles by symbolic names and refreshes them 4 times a day
osgi impl : felix
container : apache-servicemix-4.4.1-fuse-03-06
Service Dependency spec : Blueprint
There are 3 bundles along with a helper bundle .The helper bundle has all the common classes used and service interfaces . There is no code sharing among these 3 bundles (None of them export any packages ).All of them interact through camel vm endpoints and services . I only refresh the other 3 bundles and helper bundle doesn't provide any services .
Now, the problem is when ever i do an update on these 3 bundles they start up and work fine , but i see an increase of 800-900 classes on jconsole every time i do this . Forcing gc also doesn't seem to clean up these objects . So , what could these old wired objects be ? Service dependencies should get updated automatically and there are no code dependencies between the bundles .I checked the difference in the count of classes after and before the update .
i could see that count of some classes have doubled like org.apache.activemq.camel.component.VmComponent, org.apache.commons.dbcp.BasicDataSource..etc and some custom beans that i have defined in my camel routes . I am dependent on the container for camel-core,blueprint,quartz...etc .What exactly happens to the beans,VM endpoints..etc in camel-context and components defined in blueprint-config xml's on update . I know its recommended to call FrameworkWiring.refreshBundles() once you update the bundle . But, i have no code sharing between bundles and i presumed any other dependencies container should handle which i think is wrong now . And i am not sure if the current felix framework implementation in servicemix supports FrameworkWiring.refreshBundles() (ref) , i was not able to get it work . How can i fix this problem ?
Thanks sanre6