use of io.cdap.cdap.logging.logbuffer.cleaner.LogBufferCleaner in project cdap by caskdata.
the class LogBufferService method startUp.
@Override
protected void startUp() throws Exception {
// load log pipelines
List<LogBufferProcessorPipeline> bufferPipelines = loadLogPipelines();
// start all the log pipelines
validateAllFutures(Iterables.transform(pipelines, Service::start));
// recovery service and http handler will send log events to log pipelines. In order to avoid deleting file while
// reading them in recovery service, we will pass in an atomic boolean will be set to true by recovery service
// when it is done recovering data. So while recovery service is running, cleanup task will be a no-op
AtomicBoolean startCleanup = new AtomicBoolean(false);
// start log recovery service to recover all the pending logs.
recoveryService = new LogBufferRecoveryService(cConf, bufferPipelines, checkpointManagers, startCleanup);
recoveryService.startAndWait();
// create concurrent writer
ConcurrentLogBufferWriter concurrentWriter = new ConcurrentLogBufferWriter(cConf, bufferPipelines, new LogBufferCleaner(cConf, checkpointManagers, startCleanup));
// create and start http service
NettyHttpService.Builder builder = new CommonNettyHttpServiceBuilder(cConf, Constants.Service.LOG_BUFFER_SERVICE).setHttpHandlers(new LogBufferHandler(concurrentWriter)).setExceptionHandler(new HttpExceptionHandler()).setHost(cConf.get(Constants.LogBuffer.LOG_BUFFER_SERVER_BIND_ADDRESS)).setPort(cConf.getInt(Constants.LogBuffer.LOG_BUFFER_SERVER_BIND_PORT));
if (cConf.getBoolean(Constants.Security.SSL.INTERNAL_ENABLED)) {
new HttpsEnabler().configureKeyStore(cConf, sConf).enable(builder);
}
httpService = builder.build();
httpService.start();
cancellable = discoveryService.register(ResolvingDiscoverable.of(URIScheme.createDiscoverable(Constants.Service.LOG_BUFFER_SERVICE, httpService)));
}
Aggregations