|
@@ -41,7 +41,6 @@ import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
|
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
|
-import org.apache.hadoop.yarn.server.timelineservice.storage.HBaseTimelineReaderImpl;
|
|
|
|
import org.apache.hadoop.yarn.server.timelineservice.storage.TimelineReader;
|
|
import org.apache.hadoop.yarn.server.timelineservice.storage.TimelineReader;
|
|
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
|
|
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
|
|
import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider;
|
|
import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider;
|
|
@@ -72,21 +71,34 @@ public class TimelineReaderServer extends CompositeService {
|
|
}
|
|
}
|
|
|
|
|
|
TimelineReader timelineReaderStore = createTimelineReaderStore(conf);
|
|
TimelineReader timelineReaderStore = createTimelineReaderStore(conf);
|
|
|
|
+ timelineReaderStore.init(conf);
|
|
addService(timelineReaderStore);
|
|
addService(timelineReaderStore);
|
|
timelineReaderManager = createTimelineReaderManager(timelineReaderStore);
|
|
timelineReaderManager = createTimelineReaderManager(timelineReaderStore);
|
|
addService(timelineReaderManager);
|
|
addService(timelineReaderManager);
|
|
super.serviceInit(conf);
|
|
super.serviceInit(conf);
|
|
}
|
|
}
|
|
|
|
|
|
- private TimelineReader createTimelineReaderStore(Configuration conf) {
|
|
|
|
- TimelineReader readerStore = ReflectionUtils.newInstance(conf.getClass(
|
|
|
|
|
|
+ private TimelineReader createTimelineReaderStore(final Configuration conf) {
|
|
|
|
+ String timelineReaderClassName = conf.get(
|
|
YarnConfiguration.TIMELINE_SERVICE_READER_CLASS,
|
|
YarnConfiguration.TIMELINE_SERVICE_READER_CLASS,
|
|
- HBaseTimelineReaderImpl.class, TimelineReader.class), conf);
|
|
|
|
- LOG.info("Using store " + readerStore.getClass().getName());
|
|
|
|
- readerStore.init(conf);
|
|
|
|
- return readerStore;
|
|
|
|
|
|
+ YarnConfiguration.DEFAULT_TIMELINE_SERVICE_READER_CLASS);
|
|
|
|
+ LOG.info("Using store: " + timelineReaderClassName);
|
|
|
|
+ try {
|
|
|
|
+ Class<?> timelineReaderClazz = Class.forName(timelineReaderClassName);
|
|
|
|
+ if (TimelineReader.class.isAssignableFrom(timelineReaderClazz)) {
|
|
|
|
+ return (TimelineReader) ReflectionUtils.newInstance(
|
|
|
|
+ timelineReaderClazz, conf);
|
|
|
|
+ } else {
|
|
|
|
+ throw new YarnRuntimeException("Class: " + timelineReaderClassName
|
|
|
|
+ + " not instance of " + TimelineReader.class.getCanonicalName());
|
|
|
|
+ }
|
|
|
|
+ } catch (ClassNotFoundException e) {
|
|
|
|
+ throw new YarnRuntimeException("Could not instantiate TimelineReader: "
|
|
|
|
+ + timelineReaderClassName, e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
private TimelineReaderManager createTimelineReaderManager(
|
|
private TimelineReaderManager createTimelineReaderManager(
|
|
TimelineReader timelineReaderStore) {
|
|
TimelineReader timelineReaderStore) {
|
|
return new TimelineReaderManager(timelineReaderStore);
|
|
return new TimelineReaderManager(timelineReaderStore);
|