org.apache.hadoop.mapred
Class MapTask.MapOutputBuffer.BlockingBuffer

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.DataOutputStream
              extended by org.apache.hadoop.mapred.MapTask.MapOutputBuffer.BlockingBuffer
All Implemented Interfaces:
Closeable, DataOutput, Flushable
Enclosing class:
MapTask.MapOutputBuffer<K,V>

protected class MapTask.MapOutputBuffer.BlockingBuffer
extends DataOutputStream

Inner class managing the spill of serialized records to disk.


Field Summary
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
MapTask.MapOutputBuffer.BlockingBuffer()
           
 
Method Summary
 int markRecord()
          Mark end of record.
protected  void shiftBufferedKey()
          Set position from last mark to end of writable buffer, then rewrite the data between last mark and kvindex.
 
Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataOutput
write
 

Constructor Detail

MapTask.MapOutputBuffer.BlockingBuffer

public MapTask.MapOutputBuffer.BlockingBuffer()
Method Detail

markRecord

public int markRecord()
Mark end of record. Note that this is required if the buffer is to cut the spill in the proper place.


shiftBufferedKey

protected void shiftBufferedKey()
                         throws IOException
Set position from last mark to end of writable buffer, then rewrite the data between last mark and kvindex. This handles a special case where the key wraps around the buffer. If the key is to be passed to a RawComparator, then it must be contiguous in the buffer. This recopies the data in the buffer back into itself, but starting at the beginning of the buffer. Note that this method should only be called immediately after detecting this condition. To call it at any other time is undefined and would likely result in data loss or corruption.

Throws:
IOException
See Also:
markRecord()


Copyright © 2014 Apache Software Foundation. All Rights Reserved.