Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-105

how it go in method evict() of class GenericKeyedObjectPool.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.3
    • 1.4
    • None
    • windows

    Description

      in the method evict(), if the getNumTests() get 10,the key will not change , is it a problem??

      public synchronized void evict() throws Exception {
      Object key = null;
      ...............
      for(int i=0,m=getNumTests();i<m;i++) {
      System.out.println("key="+key);
      if(_poolMap.size() > 0) {
      // Find next idle object pool key to work on
      if (key == null) {
      if (!keyIter.hasNext())

      { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); }
      if (!keyIter.hasNext()) { // done, there are no keyed pools return; }
      key = keyIter.next();
      }
      ...................
      }
      }
      }
      the print out will repeat 9 times , is it right??

      i think this should move " key = keyIter.next();" to next line
      if (key == null) {
      if (!keyIter.hasNext()) { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); }

      if (!keyIter.hasNext())

      { // done, there are no keyed pools return; }

      }
      key = keyIter.next();
      ......................

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yigemaser yigemaser
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: