void publishFlushedSegment(SegmentCommitInfo newSegment,FrozenBufferedUpdates packet,FrozenBufferedUpdates globalPacket) throws IOException {
  try {
synchronized (this) {
      ensureOpen(false);
synchronized (bufferedUpdatesStream) {
        if (infoStream.isEnabled("IW")) {
          infoStream.message("IW","publishFlushedSegment");
        }
        if (globalPacket != null && globalPacket.any()) {
          bufferedUpdatesStream.push(globalPacket);
        }
        final long nextGen;
        if (packet != null && packet.any()) {
          nextGen=bufferedUpdatesStream.push(packet);
        }
 else {
          nextGen=bufferedUpdatesStream.getNextGen();
        }
        if (infoStream.isEnabled("IW")) {
          infoStream.message("IW","publish sets newSegment delGen=" + nextGen + " seg="+ segString(newSegment));
        }
        newSegment.setBufferedDeletesGen(nextGen);
        segmentInfos.add(newSegment);
        checkpoint();
      }
    }
  }
  finally {
    flushCount.incrementAndGet();
    doAfterFlush();
  }
}

void publishFlushedSegment ( SegmentCommitInfo newSegment , FrozenBufferedUpdates packet , FrozenBufferedUpdates globalPacket ) throws IOException { try { synchronized ( this ) { ensureOpen ( false ) ; synchronized ( bufferedUpdatesStream ) { if ( infoStream . isEnabled ( "IW" ) ) { infoStream . message ( "IW" , "publishFlushedSegment" ) ; } if ( globalPacket != null && globalPacket . any ( ) ) { bufferedUpdatesStream . push ( globalPacket ) ; } final long nextGen ; if ( packet != null && packet . any ( ) ) { nextGen = bufferedUpdatesStream . push ( packet ) ; } else { nextGen = bufferedUpdatesStream . getNextGen ( ) ; } if ( infoStream . isEnabled ( "IW" ) ) { infoStream . message ( "IW" , "publish sets newSegment delGen=" + nextGen + " seg=" + segString ( newSegment ) ) ; } newSegment . setBufferedDeletesGen ( nextGen ) ; segmentInfos . add ( newSegment ) ; checkpoint ( ) ; } } } finally { flushCount . incrementAndGet ( ) ; doAfterFlush ( ) ; } }
atomically adds the segment private delete packet and publishes the flushed segments segmentinfo to the index writer .
