code: public synchronized Segment lastSegment() {
      assertOpen();
      Map.Entry<Long, Segment> segment = segments.lastEntry();
      return segment != null ? segment.getValue() : null;
    }
docs: Returns the last segment in the log.
  
  @throws IllegalStateException if the segment manager is not open