code: @Override
      public void destroyObject(Object key, PooledObject<Object> pooledObject) throws Exception {
          Assert.notNull(pooledObject,
                  "The Object to destroy must not be null");
          Assert.isTrue(pooledObject.getObject() instanceof DirContext,
                  "The Object to destroy must be of type '" + DirContext.class
                          + "'");
  
          try {
              final DirContext dirContext = (DirContext) pooledObject.getObject();
              if (this.logger.isDebugEnabled()) {
                  this.logger.debug("Closing " + key + " DirContext='"
                          + dirContext + "'");
              }
              dirContext.close();
              if (this.logger.isDebugEnabled()) {
                  this.logger.debug("Closed " + key + " DirContext='"
                          + dirContext + "'");
              }
          } catch (Exception e) {
              this.logger.warn(
                      "An exception occured while closing '" + pooledObject.getObject() + "'", e);
          }
      }
docs: @see BaseKeyedPooledObjectFactory#destroyObject(Object, PooledObject)