|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hdfs.ShortCircuitShm
public class ShortCircuitShm
A shared memory segment used to implement short-circuit reads.
Nested Class Summary | |
---|---|
static class |
ShortCircuitShm.ShmId
Identifies a DfsClientShm. |
class |
ShortCircuitShm.Slot
A slot containing information about a replica. |
static class |
ShortCircuitShm.SlotId
Uniquely identifies a slot. |
class |
ShortCircuitShm.SlotIterator
|
Field Summary | |
---|---|
protected static int |
BYTES_PER_SLOT
|
Constructor Summary | |
---|---|
ShortCircuitShm(ShortCircuitShm.ShmId shmId,
FileInputStream stream)
Create the ShortCircuitShm. |
Method Summary | |
---|---|
ShortCircuitShm.Slot |
allocAndRegisterSlot(ExtendedBlockId blockId)
Allocate a new slot and register it. |
void |
free()
|
ShortCircuitShm.ShmId |
getShmId()
|
ShortCircuitShm.Slot |
getSlot(int slotIdx)
|
boolean |
isEmpty()
Determine if this shared memory object is empty. |
boolean |
isFull()
Determine if this shared memory object is full. |
ShortCircuitShm.Slot |
registerSlot(int slotIdx,
ExtendedBlockId blockId)
Register a slot. |
ShortCircuitShm.SlotIterator |
slotIterator()
Iterate over all allocated slots. |
String |
toString()
|
void |
unregisterSlot(int slotIdx)
Unregisters a slot. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int BYTES_PER_SLOT
Constructor Detail |
---|
public ShortCircuitShm(ShortCircuitShm.ShmId shmId, FileInputStream stream) throws IOException
shmId
- The ID to use.stream
- The stream that we're going to use to create this
shared memory segment.
Although this is a FileInputStream, we are going to
assume that the underlying file descriptor is writable
as well as readable. It would be more appropriate to use
a RandomAccessFile here, but that class does not have
any public accessor which returns a FileDescriptor,
unlike FileInputStream.
IOException
Method Detail |
---|
public final ShortCircuitShm.ShmId getShmId()
public final boolean isEmpty()
public final boolean isFull()
public final ShortCircuitShm.Slot allocAndRegisterSlot(ExtendedBlockId blockId)
public final ShortCircuitShm.Slot getSlot(int slotIdx) throws org.apache.hadoop.fs.InvalidRequestException
org.apache.hadoop.fs.InvalidRequestException
public final ShortCircuitShm.Slot registerSlot(int slotIdx, ExtendedBlockId blockId) throws org.apache.hadoop.fs.InvalidRequestException
org.apache.hadoop.fs.InvalidRequestException
- If the slot index we're trying to allocate has not been
initialized, or is already in use.public final void unregisterSlot(int slotIdx)
slotIdx
- Index of the slot to unregister.public ShortCircuitShm.SlotIterator slotIterator()
public void free()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |