Search in sources :

Example 1 with MappingJsonFactory

use of com.fasterxml.jackson.databind.MappingJsonFactory in project hadoop by apache.

the class EntityGroupFSTimelineStore method serviceStart.

@Override
protected void serviceStart() throws Exception {
    super.serviceStart();
    LOG.info("Starting {}", getName());
    summaryStore.start();
    Configuration conf = getConfig();
    aclManager = new TimelineACLsManager(conf);
    aclManager.setTimelineStore(summaryStore);
    summaryTdm = new TimelineDataManager(summaryStore, aclManager);
    summaryTdm.init(conf);
    addService(summaryTdm);
    // start child services that aren't already started
    super.serviceStart();
    if (!fs.exists(activeRootPath)) {
        fs.mkdirs(activeRootPath);
        fs.setPermission(activeRootPath, ACTIVE_DIR_PERMISSION);
    }
    if (!fs.exists(doneRootPath)) {
        fs.mkdirs(doneRootPath);
        fs.setPermission(doneRootPath, DONE_DIR_PERMISSION);
    }
    objMapper = new ObjectMapper();
    objMapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()));
    jsonFactory = new MappingJsonFactory(objMapper);
    final long scanIntervalSecs = conf.getLong(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SCAN_INTERVAL_SECONDS, YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SCAN_INTERVAL_SECONDS_DEFAULT);
    final long cleanerIntervalSecs = conf.getLong(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CLEANER_INTERVAL_SECONDS, YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CLEANER_INTERVAL_SECONDS_DEFAULT);
    final int numThreads = conf.getInt(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_THREADS, YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_THREADS_DEFAULT);
    LOG.info("Scanning active directory {} every {} seconds", activeRootPath, scanIntervalSecs);
    LOG.info("Cleaning logs every {} seconds", cleanerIntervalSecs);
    executor = new ScheduledThreadPoolExecutor(numThreads, new ThreadFactoryBuilder().setNameFormat("EntityLogPluginWorker #%d").build());
    executor.scheduleAtFixedRate(new EntityLogScanner(), 0, scanIntervalSecs, TimeUnit.SECONDS);
    executor.scheduleAtFixedRate(new EntityLogCleaner(), cleanerIntervalSecs, cleanerIntervalSecs, TimeUnit.SECONDS);
}
Also used : MappingJsonFactory(com.fasterxml.jackson.databind.MappingJsonFactory) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Aggregations

MappingJsonFactory (com.fasterxml.jackson.databind.MappingJsonFactory)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JaxbAnnotationIntrospector (com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 Configuration (org.apache.hadoop.conf.Configuration)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 TimelineACLsManager (org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager)1