Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.2
-
None
-
Operating System: other
Platform: Other
-
34935
Description
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.