#vulnerable code 
                                public void clear() {
        List toDestroy = new ArrayList();

        synchronized(this) {
            toDestroy.addAll(_pool);
            _numInternalProcessing = _numInternalProcessing + _pool._size;
            _pool.clear();
        }
        destroy(toDestroy);
    } 
                            #location 9 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void clear() {
        List toDestroy = new ArrayList();

        synchronized(this) {
            toDestroy.addAll(_pool);
            _numInternalProcessing = _numInternalProcessing + _pool._size;
            _pool.clear();
        }
        destroy(toDestroy, _factory);
    }