#vulnerable code 
                                protected int resize(int newSize) {
        
        if (newSize != timestamps.length) {

            LOG.debug("Resizing throttling queue from {} to {}", timestamps.length, newSize);
            Instant[] newQueue = new Instant[newSize];
            int result = 0;

            if (timestamps.length - newSize > 0) { // queue got smaller
                result = reduceSize(newQueue);

            } else { // queue got larger, just resize the timestamps array and ignore the purge till
                     // next cycle
                result = increaseSize(newQueue);
            }

            timestamps = newQueue;
            return result;

        } else {
            // Do not resize
            LOG.debug("No resizing required");

        }

        return 0;
    } 
                            #location 10 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                protected int resize(int newSize) {

        if (newSize != timestamps.length) {

            LOG.debug("Resizing throttling queue from {} to {}", timestamps.length, newSize);
            Instant[] newQueue = new Instant[newSize];
            int result = 0;

            if (timestamps.length - newSize > 0) { // queue got smaller
                result = reduceSize(newQueue);

            } else { // queue got larger, just resize the timestamps array and ignore the purge till
                // next cycle
                result = increaseSize(newQueue);
            }

            timestamps = newQueue;

            return result;

        } else {
            // Do not resize
            LOG.debug("No resizing required");

        }

        return 0;
    }