Class PeerCache

java.lang.Object
org.apache.hadoop.hdfs.PeerCache

@Unstable @Private @VisibleForTesting public class PeerCache extends Object
A cache of input stream sockets to Data Node.
  • Constructor Details

    • PeerCache

      public PeerCache(int c, long e)
  • Method Details

    • get

      public Peer get(DatanodeID dnId, boolean isDomain)
      Get a cached peer connected to the given DataNode.
      Parameters:
      dnId - The DataNode to get a Peer for.
      isDomain - Whether to retrieve a DomainPeer or not.
      Returns:
      An open Peer connected to the DN, or null if none was found.
    • put

      public void put(DatanodeID dnId, Peer peer)
      Give an unused socket to the cache.
    • size

      public int size()