Source:
<code>private void recoverSegment(long segmentIndex, long segmentId, PbdSegmentName segmentName) throws IOException { PBDSegment<M> segment; if (segmentName.m_quarantined) { segment = new PbdQuarantinedSegment<>(segmentName.m_file, segmentIndex, segmentId); } else { segment = m_pbdSegmentFactory.create(segmentIndex, segmentId, segmentName.m_file, m_usageSpecificLog, m_extraHeaderSerializer); segment.saveFileSize(); try { if (segment.getNumEntries() == 0 && m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Found Empty Segment with entries: " + segment.getNumEntries() + " For: " + segment.file().getName()); m_usageSpecificLog.debug("Segment " + segment.file() + " (final: " + segment.isFinal() + "), will be closed and deleted during init"); } segment.closeAndDelete(); return; } boolean requiresId = (segment.getStartId() >= 0); assert(m_requiresId == null || m_requiresId.booleanValue() == requiresId); assert(segment.getEndId() >= segment.getStartId()); <START> PBDSegment<M> lastSegment = peekLastSegment(); <END> assert(!requiresId || lastSegment == null || lastSegment.getEndId() < segment.getStartId()); m_requiresId = requiresId; if (!segment.isFinal()) { m_usageSpecificLog.warn("Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug( "Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered"); } } catch (IOException e) { m_usageSpecificLog.warn( "Failed to retrieve entry count from segment " + segment.file() + ". Quarantining segment", e); quarantineSegment(segment); return; } finally { segment.close(); } } m_segments.put(segment.segmentIndex(), segment); }</code><technical_language>this is for assert. Is extra expense this lookup avoided asserts disabled</technical_language>

Target:
private void recoverSegment(long segmentIndex, long segmentId, PbdSegmentName segmentName) throws IOException { PBDSegment<M> segment; if (segmentName.m_quarantined) { segment = new PbdQuarantinedSegment<>(segmentName.m_file, segmentIndex, segmentId); } else { segment = m_pbdSegmentFactory.create(segmentIndex, segmentId, segmentName.m_file, m_usageSpecificLog, m_extraHeaderSerializer); segment.saveFileSize(); try { if (segment.getNumEntries() == 0 && m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Found Empty Segment with entries: " + segment.getNumEntries() + " For: " + segment.file().getName()); m_usageSpecificLog.debug("Segment " + segment.file() + " (final: " + segment.isFinal() + "), will be closed and deleted during init"); } segment.closeAndDelete(); return; } boolean requiresId = (segment.getStartId() >= 0); assert(m_requiresId == null || m_requiresId.booleanValue() == requiresId); assert(segment.getEndId() >= segment.getStartId()); assert(!requiresId || peekLastSegment() == null || peekLastSegment().getEndId() < segment.getStartId()); m_requiresId = requiresId; if (!segment.isFinal()) { m_usageSpecificLog.warn("Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug( "Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered"); } } catch (IOException e) { m_usageSpecificLog.warn( "Failed to retrieve entry count from segment " + segment.file() + ". Quarantining segment", e); quarantineSegment(segment); return; } finally { segment.close(); } } m_segments.put(segment.segmentIndex(), segment); }