Class TimelineCollectorManager

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.service.CompositeService
org.apache.hadoop.yarn.server.timelineservice.collector.TimelineCollectorManager
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service
Direct Known Subclasses:
NodeTimelineCollectorManager

@Private @Unstable public class TimelineCollectorManager extends org.apache.hadoop.service.CompositeService
Class that manages adding and removing collectors and their lifecycle. It provides thread safety access to the collectors inside.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService

    org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHook

    Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

    org.apache.hadoop.service.Service.STATE
  • Field Summary

    Fields inherited from class org.apache.hadoop.service.CompositeService

    STOP_ONLY_STARTED_SERVICES
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    containsTimelineCollector(org.apache.hadoop.yarn.api.records.ApplicationId appId)
    Returns whether the collector for the specified id exists in this collection.
    protected void
    doPostPut(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
    A template method that will be called by postPut(ApplicationId, TimelineCollector).
    get(org.apache.hadoop.yarn.api.records.ApplicationId appId)
    Returns the collector for the specified id.
    protected TimelineWriter
     
    void
    postPut(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
    Callback handler for the timeline collector manager when a collector has been added into the collector map.
    protected void
    postRemove(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
     
    putIfAbsent(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
    Put the collector into the collection if an collector mapped by id does not exist.
    boolean
    remove(org.apache.hadoop.yarn.api.records.ApplicationId appId)
    Removes the collector for the specified id.
    protected void
    serviceInit(org.apache.hadoop.conf.Configuration conf)
     
    protected void
     
    protected void
     

    Methods inherited from class org.apache.hadoop.service.CompositeService

    addIfService, addService, getServices, removeService

    Methods inherited from class org.apache.hadoop.service.AbstractService

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TimelineCollectorManager

      public TimelineCollectorManager(String name)
  • Method Details

    • serviceInit

      protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.CompositeService
      Throws:
      Exception
    • serviceStart

      protected void serviceStart() throws Exception
      Overrides:
      serviceStart in class org.apache.hadoop.service.CompositeService
      Throws:
      Exception
    • getWriter

      protected TimelineWriter getWriter()
    • putIfAbsent

      public TimelineCollector putIfAbsent(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
      Put the collector into the collection if an collector mapped by id does not exist.
      Parameters:
      appId - Application Id for which collector needs to be put.
      collector - timeline collector to be put.
      Returns:
      the collector associated with id after the potential put.
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnRuntimeException - if there was any exception in initializing and starting the app level service
    • postPut

      public void postPut(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
      Callback handler for the timeline collector manager when a collector has been added into the collector map.
      Parameters:
      appId - Application id of the collector.
      collector - The actual timeline collector that has been added.
    • doPostPut

      protected void doPostPut(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
      A template method that will be called by postPut(ApplicationId, TimelineCollector).
      Parameters:
      appId - Application id of the collector.
      collector - The actual timeline collector that has been added.
    • remove

      public boolean remove(org.apache.hadoop.yarn.api.records.ApplicationId appId)
      Removes the collector for the specified id. The collector is also stopped as a result. If the collector does not exist, no change is made.
      Parameters:
      appId - Application Id to remove.
      Returns:
      whether it was removed successfully
    • postRemove

      protected void postRemove(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector)
    • get

      public TimelineCollector get(org.apache.hadoop.yarn.api.records.ApplicationId appId)
      Returns the collector for the specified id.
      Parameters:
      appId - Application Id for which we need to get the collector.
      Returns:
      the collector or null if it does not exist
    • containsTimelineCollector

      public boolean containsTimelineCollector(org.apache.hadoop.yarn.api.records.ApplicationId appId)
      Returns whether the collector for the specified id exists in this collection.
      Parameters:
      appId - Application Id.
      Returns:
      true if collector for the app id is found, false otherwise.
    • serviceStop

      protected void serviceStop() throws Exception
      Overrides:
      serviceStop in class org.apache.hadoop.service.CompositeService
      Throws:
      Exception