Hi 
i was checking the source for GenericKeyedObjectPool . In the method returnObject 
check if a pool exists for the returned object and if doesnt , we create one.If the 
object is borrowed using method borrowObject(Object key) the code makes sure if there 
is no pool associated with key , a new pool is created. So if object is "legally" 
borrowed ,  the pool for the object will always exist when it is returned back, where 
as if object was never borrowed at first place , there would be no pool . So in my 
opinion return object should not create pool , else this would suffer from 2 ways
1. We create an entry in pool for that key and ask factory method to destroy an object 
which was never created by it
2. the method loses its single purpose, kinda suffers from a multiple personality  
disorder.
please correct me if i am wrong ?




here are the source lines
        CursorableLinkedList pool = null;
        synchronized(this) {
            pool = (CursorableLinkedList)(_poolMap.get(key));
            // if it doesn't exist, create it
            if(null == pool) {
                pool = new CursorableLinkedList();
                _poolMap.put(key, pool);
                _poolList.add(key);
            }
        }


__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

--
To unsubscribe, e-mail:   <mailto:commons-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-user-help@;jakarta.apache.org>

Reply via email to