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

GenericObjectPool.setFactory(...) does not destroy idle pool objects with their original factory object.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4
    • 1.5.5
    • None

    Description

      When setting a new object factory, the existing idle poolable objects are not destroyed by the same factory that created them.

      1453 public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
      1454 List toDestroy = new ArrayList();
      1455 synchronized (this) {
      1456 assertOpen();
      1457 if(0 < getNumActive())

      { 1458 throw new IllegalStateException("Objects are already active"); 1459 }

      else

      { 1460 toDestroy.addAll(_pool); 1461 _numInternalProcessing = _numInternalProcessing + _pool._size; 1462 _pool.clear(); 1463 }

      1464 _factory = factory;
      1465 }
      1466 destroy(toDestroy); // <----- indirectly calls _factory.destroy(...) when _factory has already been replaced by the new factory.
      1467 }

      Attachments

        Activity

          People

            Unassigned Unassigned
            buddydvd David Hu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: