public final class IOManager extends Object implements Thread.UncaughtExceptionHandler
| Constructor and Description |
|---|
IOManager()
Constructs a new IOManager, writing channels to the system directory.
|
IOManager(String tempDir)
Constructs a new IOManager.
|
IOManager(String[] paths)
Constructs a new IOManager.
|
| Modifier and Type | Method and Description |
|---|---|
BlockChannelReader |
createBlockChannelReader(Channel.ID channelID)
Creates a block channel reader that reads blocks from the given channel.
|
BlockChannelReader |
createBlockChannelReader(Channel.ID channelID,
int numRequestsToCombine)
Creates a block channel reader that reads blocks from the given channel.
|
BlockChannelReader |
createBlockChannelReader(Channel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue)
Creates a block channel reader that reads blocks from the given channel.
|
BlockChannelReader |
createBlockChannelReader(Channel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue,
int numRequestsToCombine)
Creates a block channel reader that reads blocks from the given channel.
|
BlockChannelWriter |
createBlockChannelWriter(Channel.ID channelID)
Creates a block channel writer that writes to the given channel.
|
BlockChannelWriter |
createBlockChannelWriter(Channel.ID channelID,
int numRequestsToCombine)
Creates a block channel writer that writes to the given channel.
|
BlockChannelWriter |
createBlockChannelWriter(Channel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue)
Creates a block channel writer that writes to the given channel.
|
BlockChannelWriter |
createBlockChannelWriter(Channel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue,
int numRequestsToCombine)
Creates a block channel writer that writes to the given channel.
|
BulkBlockChannelReader |
createBulkBlockChannelReader(Channel.ID channelID,
List<MemorySegment> targetSegments,
int numBlocks)
Creates a block channel reader that reads all blocks from the given channel directly in one bulk.
|
Channel.ID |
createChannel()
Creates a new
Channel.ID in one of the temp directories. |
Channel.Enumerator |
createChannelEnumerator()
Creates a new
Channel.Enumerator, spreading the channels in a round-robin fashion
across the temporary file directories. |
boolean |
isProperlyShutDown()
Utility method to check whether the IO manager has been properly shut down.
|
void |
shutdown()
Close method.
|
void |
uncaughtException(Thread t,
Throwable e) |
public IOManager()
public IOManager(String tempDir)
path - The base directory path for files underlying channels.public IOManager(String[] paths)
path - the basic directory path for files underlying anonymous
channels.public final void shutdown()
public final boolean isProperlyShutDown()
public void uncaughtException(Thread t, Throwable e)
uncaughtException in interface Thread.UncaughtExceptionHandlerpublic Channel.ID createChannel()
Channel.ID in one of the temp directories. Multiple
invocations of this method spread the channels evenly across the different directories.public Channel.Enumerator createChannelEnumerator()
Channel.Enumerator, spreading the channels in a round-robin fashion
across the temporary file directories.public BlockChannelWriter createBlockChannelWriter(Channel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException
channelID - The descriptor for the channel to write to.returnQueue - The queue to put the written buffers into.IOException - Thrown, if the channel for the writer could not be opened.public BlockChannelWriter createBlockChannelWriter(Channel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue, int numRequestsToCombine) throws IOException
The writer will collect a specified number of write requests and carry them out in one, effectively writing one block in the size of multiple memory pages. Note that this means that no memory segment will reach the return queue before the given number of requests are collected, so the number of buffers used with the writer should be greater than the number of requests to combine. Ideally, the number of memory segments used is a multiple of the number of requests to combine.
channelID - The descriptor for the channel to write to.returnQueue - The queue to put the written buffers into.numRequestsToCombine - The number of write requests to combine to one I/O request.IOException - Thrown, if the channel for the writer could not be opened.public BlockChannelWriter createBlockChannelWriter(Channel.ID channelID) throws IOException
channelID - The descriptor for the channel to write to.IOException - Thrown, if the channel for the writer could not be opened.public BlockChannelWriter createBlockChannelWriter(Channel.ID channelID, int numRequestsToCombine) throws IOException
The writer will collect a specified number of write requests and carry them out in one, effectively writing one block in the size of multiple memory pages. Note that this means that no memory segment will reach the return queue before the given number of requests are collected, so the number of buffers used with the writer should be greater than the number of requests to combine. Ideally, the number of memory segments used is a multiple of the number of requests to combine.
channelID - The descriptor for the channel to write to.numRequestsToCombine - The number of write requests to combine to one I/O request.IOException - Thrown, if the channel for the writer could not be opened.public BlockChannelReader createBlockChannelReader(Channel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException
channelID - The descriptor for the channel to write to.returnQueue - The queue to put the full buffers into.IOException - Thrown, if the channel for the reader could not be opened.public BlockChannelReader createBlockChannelReader(Channel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue, int numRequestsToCombine) throws IOException
The reader will collect a specified number of read requests and carry them out in one, effectively reading one block in the size of multiple memory pages. Note that this means that no memory segment will reach the return queue before the given number of requests are collected, so the number of buffers used with the reader should be greater than the number of requests to combine. Ideally, the number of memory segments used is a multiple of the number of requests to combine.
channelID - The descriptor for the channel to write to.returnQueue - The queue to put the full buffers into.numRequestsToCombine - The number of read requests to combine to one I/O request.IOException - Thrown, if the channel for the reader could not be opened.public BlockChannelReader createBlockChannelReader(Channel.ID channelID) throws IOException
channelID - The descriptor for the channel to write to.IOException - Thrown, if the channel for the reader could not be opened.public BlockChannelReader createBlockChannelReader(Channel.ID channelID, int numRequestsToCombine) throws IOException
The reader will collect a specified number of read requests and carry them out in one, effectively reading one block in the size of multiple memory pages. Note that this means that no memory segment will reach the return queue before the given number of requests are collected, so the number of buffers used with the reader should be greater than the number of requests to combine. Ideally, the number of memory segments used is a multiple of the number of requests to combine.
channelID - The descriptor for the channel to write to.numRequestsToCombine - The number of write requests to combine to one I/O request.IOException - Thrown, if the channel for the reader could not be opened.public BulkBlockChannelReader createBulkBlockChannelReader(Channel.ID channelID, List<MemorySegment> targetSegments, int numBlocks) throws IOException
If a channel is not to be read in one bulk, but in multiple smaller batches, a
BlockChannelReader should be used.
channelID - The descriptor for the channel to write to.targetSegments - The list to take the segments from into which to read the data.numBlocks - The number of blocks in the channel to read.IOException - Thrown, if the channel for the reader could not be opened.Copyright © 2014 The Apache Software Foundation. All rights reserved.