DfsClientShm (Apache Hadoop HDFS Client 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.shortcircuit, class: DfsClientShm

Package org.apache.hadoop.hdfs.shortcircuit

# Class DfsClientShm

java.lang.Object
org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm
org.apache.hadoop.hdfs.shortcircuit.DfsClientShm

All Implemented Interfaces:
  `org.apache.hadoop.net.unix.DomainSocketWatcher.Handler`

public class DfsClientShm extends ShortCircuitShm implements org.apache.hadoop.net.unix.DomainSocketWatcher.Handler
DfsClientShm is a subclass of ShortCircuitShm which is used by the DfsClient. When the UNIX domain socket associated with this shared memory segment closes unexpectedly, we mark the slots inside this segment as disconnected. ShortCircuitReplica objects that contain disconnected slots are stale, and will not be used to service new reads or mmap operations. However, in-progress read or mmap operations will continue to proceed. Once the last slot is deallocated, the segment can be safely munmapped. Slots may also become stale because the associated replica has been deleted on the DataNode. In this case, the DataNode will clear the 'valid' bit. The client will then see these slots as stale (see #{ShortCircuitReplica#isStale}).

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm

  `ShortCircuitShm.ShmId, ShortCircuitShm.Slot, ShortCircuitShm.SlotId, ShortCircuitShm.SlotIterator`

- ## Field Summary

  ### Fields inherited from class org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm

  `BYTES_PER_SLOT`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.apache.hadoop.hdfs.shortcircuit.DfsClientShmManager.EndpointShmManager`
  `getEndpointShmManager()`
  `DomainPeer`
  `getPeer()`
  `boolean`
  `handle(org.apache.hadoop.net.unix.DomainSocket sock)`
  Handle the closure of the UNIX domain socket associated with this shared memory segment by marking this segment as stale.
  `boolean`
  `isDisconnected()`
  Determine if the shared memory segment is disconnected from the DataNode.

  ### Methods inherited from class org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm

  `allocAndRegisterSlot, free, getShmId, getSlot, isEmpty, isFull, registerSlot, slotIterator, toString, unregisterSlot`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### getEndpointShmManager

    public org.apache.hadoop.hdfs.shortcircuit.DfsClientShmManager.EndpointShmManager getEndpointShmManager()

  - ### getPeer

    public DomainPeer getPeer()

  - ### isDisconnected

    public boolean isDisconnected()
    Determine if the shared memory segment is disconnected from the DataNode. This must be called with the DfsClientShmManager lock held.
    Returns:
      True if the shared memory segment is stale.

  - ### handle

    public boolean handle(org.apache.hadoop.net.unix.DomainSocket sock)
    Handle the closure of the UNIX domain socket associated with this shared memory segment by marking this segment as stale. If there are no slots associated with this shared memory segment, it will be freed immediately in this function.
    Specified by:
      `handle` in interface `org.apache.hadoop.net.unix.DomainSocketWatcher.Handler`