java.lang.Object
org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity
All Implemented Interfaces:
Comparable<TimelineEntity>
Direct Known Subclasses:
FlowActivityEntity, HierarchicalTimelineEntity, UserEntity

@Public @Unstable public class TimelineEntity extends Object implements Comparable<TimelineEntity>
The basic timeline entity data structure for timeline service v2. Timeline entity objects are not thread safe and should not be accessed concurrently. All collection members will be initialized into empty collections. Two timeline entities are equal iff. their type and id are identical. All non-primitive type, non-collection members will be initialized into null. User should set the type and id of a timeline entity to make it valid (can be checked by using the isValid() method). Callers to the getters should perform null checks for non-primitive type, non-collection members. Callers are recommended not to alter the returned collection objects from the getters.
  • Field Details

  • Constructor Details

    • TimelineEntity

      public TimelineEntity()
    • TimelineEntity

      public TimelineEntity(TimelineEntity entity)

      The constuctor is used to construct a proxy TimelineEntity or its subclass object from the real entity object that carries information.

      It is usually used in the case where we want to recover class polymorphism after deserializing the entity from its JSON form.

      Parameters:
      entity - the real entity that carries information
    • TimelineEntity

      protected TimelineEntity(String type)
  • Method Details

    • getType

      public String getType()
    • setType

      public void setType(String type)
    • getId

      public String getId()
    • setId

      public void setId(String id)
    • getIdentifier

      public TimelineEntity.Identifier getIdentifier()
    • setIdentifier

      public void setIdentifier(TimelineEntity.Identifier entityIdentifier)
    • getInfoJAXB

      @Private public HashMap<String,Object> getInfoJAXB()
    • getInfo

      public Map<String,Object> getInfo()
    • setInfo

      public void setInfo(Map<String,Object> entityInfos)
    • addInfo

      public void addInfo(Map<String,Object> entityInfos)
    • addInfo

      public void addInfo(String key, Object value)
    • getConfigsJAXB

      @Private public HashMap<String,String> getConfigsJAXB()
    • getConfigs

      public Map<String,String> getConfigs()
    • setConfigs

      public void setConfigs(Map<String,String> entityConfigs)
    • addConfigs

      public void addConfigs(Map<String,String> entityConfigs)
    • addConfig

      public void addConfig(String key, String value)
    • getMetrics

      public Set<TimelineMetric> getMetrics()
    • setMetrics

      public void setMetrics(Set<TimelineMetric> entityMetrics)
    • addMetrics

      public void addMetrics(Set<TimelineMetric> entityMetrics)
    • addMetric

      public void addMetric(TimelineMetric metric)
    • getEvents

      public NavigableSet<TimelineEvent> getEvents()
    • setEvents

      public void setEvents(NavigableSet<TimelineEvent> entityEvents)
    • addEvents

      public void addEvents(Set<TimelineEvent> entityEvents)
    • addEvent

      public void addEvent(TimelineEvent event)
    • getIsRelatedToEntities

      public Map<String,Set<String>> getIsRelatedToEntities()
    • getIsRelatedToEntitiesJAXB

      @Private public HashMap<String,Set<String>> getIsRelatedToEntitiesJAXB()
    • setIsRelatedToEntities

      public void setIsRelatedToEntities(Map<String,Set<String>> isRelatedTo)
    • addIsRelatedToEntities

      public void addIsRelatedToEntities(Map<String,Set<String>> isRelatedTo)
    • addIsRelatedToEntity

      public void addIsRelatedToEntity(String type, String id)
    • getRelatesToEntitiesJAXB

      @Private public HashMap<String,Set<String>> getRelatesToEntitiesJAXB()
    • getRelatesToEntities

      public Map<String,Set<String>> getRelatesToEntities()
    • addRelatesToEntities

      public void addRelatesToEntities(Map<String,Set<String>> relatesTo)
    • addRelatesToEntity

      public void addRelatesToEntity(String type, String id)
    • setRelatesToEntities

      public void setRelatesToEntities(Map<String,Set<String>> relatesTo)
    • getCreatedTime

      public Long getCreatedTime()
    • setCreatedTime

      public void setCreatedTime(Long createdTs)
    • setUID

      public void setUID(String uidKey, String uId)
      Set UID in info which will be then used for query by UI.
      Parameters:
      uidKey - key for UID in info.
      uId - UID to be set for the key.
    • isValid

      public boolean isValid()
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(TimelineEntity other)
      Specified by:
      compareTo in interface Comparable<TimelineEntity>
    • getReal

      protected TimelineEntity getReal()
    • toString

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

      public long getIdPrefix()
    • setIdPrefix

      public void setIdPrefix(long entityIdPrefix)
      Sets idPrefix for an entity.

      Note: Entities will be stored in the order of idPrefix specified. If users decide to set idPrefix for an entity, they MUST provide the same prefix for every update of this entity.

      Example:
       TimelineEntity entity = new TimelineEntity();
       entity.setIdPrefix(value);
       
      Users can use TimelineServiceHelper.invertLong(long) to invert the prefix if necessary.
      Parameters:
      entityIdPrefix - prefix for an entity.