Summary: [pool] changes the borrowObject method so it advoids
catching an exception
Version: 1.2 Final
AssignedTo: [hidden email] ReportedBy: [hidden email]
From Sandy McArthur 2005-05-13 23:38
changes the borrowObject method so it advoids catching an exception
as part of the normal code path
This is a performance patch for the borrowObject method. The current (1.2)
implementaion of this method uses an EmptyStackException thrown by the backing
Stack's pop() method as part of the normal code flow to determine if the
factory should be used to make a new object.
When possible this should be advoided because a lock across the entire JVM must
be aquired when populating the stack trace of an Exception. This can have a
siginificant effect on a multi-processor box.
In this situation it is possible to advoid an Exception by checking the result
of the Stack.empty() method. This patch replaces the try/catch with an if/else.