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.CompositeServiceShutdownHookNested 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 -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsTimelineCollector(org.apache.hadoop.yarn.api.records.ApplicationId appId) Returns whether the collector for the specified id exists in this collection.protected voiddoPostPut(org.apache.hadoop.yarn.api.records.ApplicationId appId, TimelineCollector collector) A template method that will be called bypostPut(ApplicationId, TimelineCollector).get(org.apache.hadoop.yarn.api.records.ApplicationId appId) Returns the collector for the specified id.protected TimelineWritervoidpostPut(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 voidpostRemove(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.booleanremove(org.apache.hadoop.yarn.api.records.ApplicationId appId) Removes the collector for the specified id.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidMethods inherited from class org.apache.hadoop.service.CompositeService
addIfService, addService, getServices, removeServiceMethods 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
-
Constructor Details
-
TimelineCollectorManager
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
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 bypostPut(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
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
- Overrides:
serviceStopin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-