@Override
    public void release() {
        releaseHook.run();
        if (records instanceof PooledResource) {
            ((PooledResource) records).release();
        }
    }
A wrapper of {@link Records} which will run the specified release hook when {@link #release()} is called.
clients/src/main/java/org/apache/kafka/common/record/PooledRecords.java