commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/pool/src/java/org/apache/commons/pool/impl GenericKeyedObjectPool.java
Date Fri, 18 Apr 2003 21:36:52 GMT
rwaldhoff    2003/04/18 14:36:52

  Modified:    pool/src/java/org/apache/commons/pool/impl
                        GenericKeyedObjectPool.java
  Log:
  apply Anna Kreglewska's patch to bug 17990, fixing sync problem in returnObject
  
  Revision  Changes    Path
  1.16      +12 -16    jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
  
  Index: GenericKeyedObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- GenericKeyedObjectPool.java	18 Apr 2003 20:58:40 -0000	1.15
  +++ GenericKeyedObjectPool.java	18 Apr 2003 21:36:51 -0000	1.16
  @@ -871,18 +871,6 @@
   
       public void returnObject(Object key, Object obj) throws Exception {
   
  -        // grab the pool (list) of objects associated with the given key
  -        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);
  -            }
  -        }
  -
           // if we need to validate this object, do so
           boolean success = true; // whether or not this object passed validation
           if((_testOnReturn && !_factory.validateObject(key, obj))) {
  @@ -902,6 +890,14 @@
   
           boolean shouldDestroy = false;
           synchronized(this) {
  +            // grab the pool (list) of objects associated with the given key
  +            CursorableLinkedList 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);
  +            }
               // subtract one from the total and keyed active counts
               _totalActive--;
               Integer active = (Integer)(_activeMap.get(key));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message