org.apache.hadoop.hdfs.client
Class DfsClientShm

java.lang.Object
  extended by org.apache.hadoop.hdfs.ShortCircuitShm
      extended by org.apache.hadoop.hdfs.client.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 stale. ShortCircuitReplica objects that contain stale slots are themselves 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.ShortCircuitShm
ShortCircuitShm.ShmId, ShortCircuitShm.Slot, ShortCircuitShm.SlotId, ShortCircuitShm.SlotIterator
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hdfs.ShortCircuitShm
BYTES_PER_SLOT
 
Method Summary
 org.apache.hadoop.hdfs.client.DfsClientShmManager.EndpointShmManager getEndpointShmManager()
           
 org.apache.hadoop.hdfs.net.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 isStale()
          Determine if the shared memory segment is stale.
 
Methods inherited from class org.apache.hadoop.hdfs.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 Detail

getEndpointShmManager

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

getPeer

public org.apache.hadoop.hdfs.net.DomainPeer getPeer()

isStale

public boolean isStale()
Determine if the shared memory segment is stale. 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


Copyright © 2014 Apache Software Foundation. All Rights Reserved.