Пример #1
0
 public void ReturnCompressor(Compressor compressor)
 {
     if (compressor != null)
     {
         if (Log.IsDebugEnabled())
         {
             Log.Debug("Return a compressor: " + compressor.GetHashCode());
         }
         CodecPool.ReturnCompressor(compressor);
     }
 }
Пример #2
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Close()
 {
     // When IFile writer is created by BackupStore, we do not have
     // Key and Value classes set. So, check before closing the
     // serializers
     if (keyClass != null)
     {
         keySerializer.Close();
         valueSerializer.Close();
     }
     // Write EOF_MARKER for key/value length
     WritableUtils.WriteVInt(@out, EofMarker);
     WritableUtils.WriteVInt(@out, EofMarker);
     decompressedBytesWritten += 2 * WritableUtils.GetVIntSize(EofMarker);
     //Flush the stream
     @out.Flush();
     if (compressOutput)
     {
         // Flush
         compressedOut.Finish();
         compressedOut.ResetState();
     }
     // Close the underlying stream iff we own it...
     if (ownOutputStream)
     {
         @out.Close();
     }
     else
     {
         // Write the checksum
         checksumOut.Finish();
     }
     compressedBytesWritten = rawOut.GetPos() - start;
     if (compressOutput)
     {
         // Return back the compressor
         CodecPool.ReturnCompressor(compressor);
         compressor = null;
     }
     @out = null;
     if (writtenRecordsCounter != null)
     {
         writtenRecordsCounter.Increment(numRecordsWritten);
     }
 }