Optimization 38: Last In, First Out On multithreaded
Key Points . Object creation could be expensive. It includes the cost of memory allocation and initialization of the object’s direct instance variables as well as those instance variables inherited from each and every superclass. . Object destruction is performed implicitly as part of garbage collection. Like creation, object destruction is not free. It contributes to the overall cost of garbage collection. . Many class implementations provide a reset operation to restore an object to its initial state. Often, this is much more economical than polluting the code with new objects. It also lightens the load on garbage collection. . Recycling a single object is a special case of an object pool of size 1. It is the simplest and fastest recycling mechanism. Otherwise, if you cannot tell in advance how many objects are required during execution, you can still tap into the benefits of recycling by using object pools. . In the special case of a thread pool, it is more efficient to enforce a LIFO policy to better utilize the system’s limited cache and memory space. Page 143
Hint: If you are looking for very good and affordable webspace to host and run your j2ee hosting application check Virtualwebstudio j2ee web hosting services