Alex Rivera | Logout

What is Object Pooling in Java?

Asked 2011-02-07T13:05:52.827
35

What is object pooling and what is a weak object reference ?

How can we implement them using Java?

Edit
Report

1 Answer

5

An object pool is any collection of object which are recycled, rather than recreated each time they are needed.

There are a number of ways you can implement such an Object Pool depending on your requirements. Object pools used to help performance even for simple objects but are not as useful in Java 5+.

I suggest you only use them for objects which connection to external resources such as file, sockets or database connections.

answered 2011-02-07T13:29:53.180

Your Answer