I have a core JAR that provides some functionality and hence used in lots of other apps as well - desktop apps, web apps etc. Now this core JAR maintains an object pool containing objects that are computationally expensive to create. The object pool is of fixed size and hence I create all of the objects at once and populate the pool. What I want to do is that whenever the app using my JAR is loaded, the object pool is created without the application knowing about the details of such a pool. And that even though the app load time will take a hit because of the pool population, but once the app is past this stage, there shouldn't be any more performance hit in creation of such heavy objects later.
Is there a way to achieve this?