public class ShortCircuitShm extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | ShortCircuitShm.ShmIdIdentifies a DfsClientShm. | 
| class  | ShortCircuitShm.SlotA slot containing information about a replica. | 
| static class  | ShortCircuitShm.SlotIdUniquely identifies a slot. | 
| class  | ShortCircuitShm.SlotIterator | 
| Modifier and Type | Field and Description | 
|---|---|
| protected static int | BYTES_PER_SLOT | 
| Constructor and Description | 
|---|
| ShortCircuitShm(ShortCircuitShm.ShmId shmId,
               FileInputStream stream)Create the ShortCircuitShm. | 
| Modifier and Type | Method and Description | 
|---|---|
| ShortCircuitShm.Slot | allocAndRegisterSlot(org.apache.hadoop.hdfs.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,
            org.apache.hadoop.hdfs.ExtendedBlockId blockId)Register a slot. | 
| ShortCircuitShm.SlotIterator | slotIterator()Iterate over all allocated slots. | 
| String | toString() | 
| void | unregisterSlot(int slotIdx)Unregisters a slot. | 
protected static final int BYTES_PER_SLOT
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.IOExceptionpublic final ShortCircuitShm.ShmId getShmId()
public final boolean isEmpty()
public final boolean isFull()
public final ShortCircuitShm.Slot allocAndRegisterSlot(org.apache.hadoop.hdfs.ExtendedBlockId blockId)
public final ShortCircuitShm.Slot getSlot(int slotIdx) throws org.apache.hadoop.fs.InvalidRequestException
org.apache.hadoop.fs.InvalidRequestExceptionpublic final ShortCircuitShm.Slot registerSlot(int slotIdx, org.apache.hadoop.hdfs.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()
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.