You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/06/12 00:56:28 UTC
DO NOT REPLY [Bug 20693] New: -
returnObject(...) of StackKeyedObjectPool does not decrement active reference count
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20693>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20693
returnObject(...) of StackKeyedObjectPool does not decrement active reference count
Summary: returnObject(...) of StackKeyedObjectPool does not
decrement active reference count
Product: Commons
Version: 1.0.1 Final
Platform: All
OS/Version: Windows XP
Status: NEW
Severity: Blocker
Priority: Other
Component: Pool
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: se00010@fh-hagenberg.at
i am using a StackKeyedObjectPool to manage objects representing users of a web
forum, each one identified by a unique id. i do not want to allow two clients
(threads) to borrow the same user object at the same time. therefore, i call
'getNumActive(key)', which must return 0, before returning the desired user
object with 'borrowObject(key)'. if another thread still holds a reference
('getNumActive(key)' > 0), i call wait on the thread trying to borrow the user
object until the active ref count is 0.
i wrote a testcase where several threads try to borrow the same user from the
pool again and again.
when taking a user (by id) with 'borrowObject(key)' the active count on this
user gets incremented correctly.
however, when i put an object back to into the pool by calling
'returnObject(key, obj)', the active reference count is not decremented.
this causes all threads in my testcase to wait forever, because they sleep until
the active count for the desired user object is 0. since the count, after
borrowing and returning the object for the first time, never gets decreased, the
threads never abort...
'returnObject(key, obj)' calls validate() but does not call passivate() (which
should be called when returning objects, as far as i know).
however, when i am using a GenericKeyedObjectPool instead of a
StackKeyedObjectPool, everything runs well (active count gets decremented
correctly)...
a bug or my mistake?
sebastian
se00010@fh-hagenberg.at
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org