Exemplo n.º 1
0
 public void ReturnDecompressor(Decompressor decompressor)
 {
     if (decompressor != null)
     {
         if (Log.IsDebugEnabled())
         {
             Log.Debug("Returned a decompressor: " + decompressor.GetHashCode());
         }
         CodecPool.ReturnDecompressor(decompressor);
     }
 }
Exemplo n.º 2
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Close()
 {
     // Close the underlying stream
     @in.Close();
     // Release the buffer
     dataIn = null;
     buffer = null;
     if (readRecordsCounter != null)
     {
         readRecordsCounter.Increment(numRecordsRead);
     }
     // Return the decompressor
     if (decompressor != null)
     {
         decompressor.Reset();
         CodecPool.ReturnDecompressor(decompressor);
         decompressor = null;
     }
 }
Exemplo n.º 3
0
 /// <exception cref="System.IO.IOException"/>
 public override void Close()
 {
     lock (this)
     {
         try
         {
             if (@in != null)
             {
                 @in.Close();
             }
         }
         finally
         {
             if (decompressor != null)
             {
                 CodecPool.ReturnDecompressor(decompressor);
                 decompressor = null;
             }
         }
     }
 }
 /// <exception cref="System.IO.IOException"/>
 public override void Close()
 {
     lock (this)
     {
         try
         {
             if (inputStream != null)
             {
                 inputStream.Close();
                 inputStream = null;
             }
         }
         finally
         {
             if (decompressor != null)
             {
                 CodecPool.ReturnDecompressor(decompressor);
                 decompressor = null;
             }
         }
     }
 }
Exemplo n.º 5
0
        /// <exception cref="System.IO.IOException"/>
        public override void Shuffle(MapHost host, InputStream input, long compressedLength
                                     , long decompressedLength, ShuffleClientMetrics metrics, Reporter reporter)
        {
            IFileInputStream checksumIn = new IFileInputStream(input, compressedLength, conf);

            input = checksumIn;
            // Are map-outputs compressed?
            if (codec != null)
            {
                decompressor.Reset();
                input = codec.CreateInputStream(input, decompressor);
            }
            try
            {
                IOUtils.ReadFully(input, memory, 0, memory.Length);
                metrics.InputBytes(memory.Length);
                reporter.Progress();
                Log.Info("Read " + memory.Length + " bytes from map-output for " + GetMapId());
                if (input.Read() >= 0)
                {
                    throw new IOException("Unexpected extra bytes from input stream for " + GetMapId(
                                              ));
                }
            }
            catch (IOException ioe)
            {
                // Close the streams
                IOUtils.Cleanup(Log, input);
                // Re-throw
                throw;
            }
            finally
            {
                CodecPool.ReturnDecompressor(decompressor);
            }
        }