code: @Override
      public Collection<SegmentProperties> getActiveSegments() {
          ensureRunning();
          logRequest("getActiveSegments");
  
          // To reduce locking in the metadata, we first get the list of Segment Ids, then we fetch their metadata
          // one by one. This only locks the metadata on the first call and, individually, on each call to getStreamSegmentMetadata.
          return this.metadata.getAllStreamSegmentIds()
                  .stream()
                  .map(this.metadata::getStreamSegmentMetadata)
                  .filter(Objects::nonNull)
                  .map(SegmentMetadata::getSnapshot)
                  .collect(Collectors.toList());
      }
docs: region SegmentContainer Implementation