public void put(JSONObject sample) throws InterruptedException {
        lock.lock();
        try {
            samples.add(sample);
            if (samples.size() >= batchSize) {
                lessThenBatchSizeCondition.signal();
            }
        } finally {
            lock.unlock();
        }
    }