I have a CAF application (AppTest) with multiple portlets (Portlet A, Portlet B). I have created a custom pojo for object caching (singleton). When the caching object is created first time it loads all the application wide properties into the cache. I am looking for solution to achieve following
- To instantiate the singleton object (load the cache) during application startup. I guess if I put this logic in portlet initialize method then the first request to the application may take a hit. So how should I preload the cache before the first request is handled by my application (similar to load-on-startup for servlet).
- Where to provide clean up logic. I want to call a destroy method in my singleton object to shutdown the cache before the application is brought down.