Class BlockManagerId

Object
org.apache.spark.storage.BlockManagerId
All Implemented Interfaces:
Externalizable, Serializable

public class BlockManagerId extends Object implements Externalizable
:: DeveloperApi :: This class represent a unique identifier for a BlockManager.

The first 2 constructors of this class are made private to ensure that BlockManagerId objects can be created only using the apply method in the companion object. This allows de-duplication of ID objects. Also, constructor parameters are private to ensure that parameters cannot be modified from outside this class.

See Also:
  • Constructor Details

    • BlockManagerId

      public BlockManagerId()
  • Method Details

    • apply

      public static BlockManagerId apply(String execId, String host, int port, scala.Option<String> topologyInfo)
      Returns a BlockManagerId for the given configuration.

      Parameters:
      execId - ID of the executor.
      host - Host name of the block manager.
      port - Port of the block manager.
      topologyInfo - topology information for the blockmanager, if available This can be network topology information for use while choosing peers while replicating data blocks. More information available here: TopologyMapper
      Returns:
      A new BlockManagerId.
    • apply

      public static BlockManagerId apply(ObjectInput in)
    • blockManagerIdCache

      public static com.google.common.cache.LoadingCache<BlockManagerId,BlockManagerId> blockManagerIdCache()
      The max cache size is hardcoded to 10000, since the size of a BlockManagerId object is about 48B, the total memory cost should be below 1MB which is feasible.
      Returns:
      (undocumented)
    • getCachedBlockManagerId

      public static BlockManagerId getCachedBlockManagerId(BlockManagerId id)
    • executorId

      public String executorId()
    • hostPort

      public String hostPort()
    • host

      public String host()
    • port

      public int port()
    • topologyInfo

      public scala.Option<String> topologyInfo()
    • isDriver

      public boolean isDriver()
    • writeExternal

      public void writeExternal(ObjectOutput out)
      Specified by:
      writeExternal in interface Externalizable
    • readExternal

      public void readExternal(ObjectInput in)
      Specified by:
      readExternal in interface Externalizable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object that)
      Overrides:
      equals in class Object