@Internal @Deprecated public class BufferSpiller extends Object implements BufferBlocker
This implementation buffers data effectively in the OS cache, which gracefully extends to the disk. Most data is written and re-read milliseconds later. The file is deleted after the read. Consequently, in most cases, the data will never actually hit the physical disks.
IMPORTANT: The SpilledBufferOrEventSequences created by this spiller all reuse the same reading memory (to reduce overhead) and can consequently not be read concurrently.
Modifier and Type | Class and Description |
---|---|
static class |
BufferSpiller.SpilledBufferOrEventSequence
Deprecated.
|
Constructor and Description |
---|
BufferSpiller(IOManager ioManager,
int pageSize)
Deprecated.
Creates a new buffer spiller, spilling to one of the I/O manager's temp directories.
|
Modifier and Type | Method and Description |
---|---|
void |
add(BufferOrEvent boe)
Deprecated.
Adds a buffer or event to the sequence of spilled buffers and events.
|
void |
close()
Deprecated.
Cleans up the current spilling channel and file.
|
long |
getBytesBlocked()
Deprecated.
Gets the number of bytes written in the current spill file.
|
BufferOrEventSequence |
rollOverReusingResources()
Deprecated.
NOTE: The BufferOrEventSequences created by this method all reuse the same reading memory
(to reduce overhead) and can consequently not be read concurrently with each other.
|
BufferOrEventSequence |
rollOverWithoutReusingResources()
Deprecated.
The BufferOrEventSequence returned by this method is safe for concurrent consumption with
any previously returned sequence.
|
public BufferSpiller(IOManager ioManager, int pageSize) throws IOException
ioManager
- The I/O manager for access to teh temp directories.pageSize
- The page size used to re-create spilled buffers.IOException
- Thrown if the temp files for spilling cannot be initialized.public void add(BufferOrEvent boe) throws IOException
add
in interface BufferBlocker
boe
- The buffer or event to add and spill.IOException
- Thrown, if the buffer of event could not be spilled.public BufferOrEventSequence rollOverReusingResources() throws IOException
To create a sequence that can be read concurrently with the previous BufferOrEventSequence,
use the rollOverWithoutReusingResources()
()} method.
rollOverReusingResources
in interface BufferBlocker
IOException
- Thrown, if the readable sequence could not be created, or no new spill
file could be created.public BufferOrEventSequence rollOverWithoutReusingResources() throws IOException
rollOverWithoutReusingResources
in interface BufferBlocker
IOException
- Thrown, if the readable sequence could not be created, or no new spill
file could be created.public void close() throws IOException
Does not clean up the SpilledBufferOrEventSequences generated by calls to
rollOver(boolean false)
.
close
in interface BufferBlocker
IOException
- Thrown if channel closing or file deletion fail.public long getBytesBlocked()
getBytesBlocked
in interface BufferBlocker
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.