@Override public final void initialize(TwillContext context) { Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler()); super.initialize(context); name = context.getSpecification().getName(); LOG.info("Initializing runnable {}", name); Map<String, String> configs = context.getSpecification().getConfigs(); try { // Load configuration hConf = new Configuration(); hConf.clear(); hConf.addResource(new File(configs.get("hConf")).toURI().toURL()); UserGroupInformation.setConfiguration(hConf); cConf = CConfiguration.create(new File(configs.get("cConf"))); LOG.debug("{} cConf {}", name, cConf); LOG.debug("{} HBase conf {}", name, hConf); Injector injector = doInit(context); services = Lists.newArrayList(); // Add common base services services.add(injector.getInstance(ZKClientService.class)); services.add(injector.getInstance(KafkaClientService.class)); services.add(injector.getInstance(BrokerService.class)); services.add(injector.getInstance(MetricsCollectionService.class)); addServices(services); Preconditions.checkArgument(!services.isEmpty(), "Should have at least one service"); LOG.info("Runnable initialized {}", name); } catch (Throwable t) { throw Throwables.propagate(t); } }
@Override public final void initialize(TwillContext context) { Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler()); super.initialize(context); name = context.getSpecification().getName(); LOG.info("Initializing runnable {}", name); Map<String, String> configs = context.getSpecification().getConfigs(); try { // Load configuration hConf = new Configuration(); hConf.clear(); hConf.addResource(new File(configs.get("hConf")).toURI().toURL()); UserGroupInformation.setConfiguration(hConf); cConf = CConfiguration.create(new File(configs.get("cConf"))); LOG.debug("{} cConf {}", name, cConf); LOG.debug("{} HBase conf {}", name, hConf); Injector injector = doInit(context); services = Lists.newArrayList(); // Add common base services services.add(injector.getInstance(ZKClientService.class)); services.add(injector.getInstance(KafkaClientService.class)); services.add(injector.getInstance(BrokerService.class)); services.add(injector.getInstance(MetricsCollectionService.class)); addServices(services); Preconditions.checkArgument(!services.isEmpty(), "Should have at least one service"); LOG.info("Runnable initialized {}", name); } catch (Throwable t) { throw Throwables.propagate(t); } }