public ElasticLogSegment remove(long baseOffset) {
        segmentLock.lock();
        try {
            ElasticLogSegment segment = segments.remove(baseOffset);
            if (segment != null) {
                notifyLogEventListeners(segment, LogEventListener.Event.SEGMENT_DELETE);
            }
            return segment;
        } finally {
            segmentLock.unlock();
        }
    }
The lock of {@link #segments} and {@link #inflightCleanedSegments}
core/src/main/scala/kafka/log/streamaspect/ElasticLogSegmentManager.java