use of co.cask.cdap.messaging.store.hbase.HBaseTableFactory in project cdap by caskdata.
the class MessagingServiceTwillRunnable method doInit.
@Override
protected Injector doInit(TwillContext context) {
CConfiguration cConf = getCConfiguration();
cConf.set(Constants.MessagingSystem.HTTP_SERVER_BIND_ADDRESS, context.getHost().getHostName());
cConf.setInt(Constants.MessagingSystem.CONTAINER_INSTANCE_ID, context.getInstanceId());
injector = createInjector(cConf, getConfiguration());
injector.getInstance(LogAppenderInitializer.class).initialize();
LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.MESSAGING_SERVICE));
HBaseTableFactory tableFactory = getHBaseTableFactory(injector.getInstance(TableFactory.class));
// Upgrade the TMS Message and Payload Tables
if (tableFactory != null) {
try {
tableFactory.upgradeMessageTable(cConf.get(Constants.MessagingSystem.MESSAGE_TABLE_NAME));
} catch (IOException ex) {
LOG.warn("Exception while trying to upgrade TMS MessageTable.", ex);
}
try {
tableFactory.upgradePayloadTable(cConf.get(Constants.MessagingSystem.PAYLOAD_TABLE_NAME));
} catch (IOException ex) {
LOG.warn("Exception while trying to upgrade TMS PayloadTable.", ex);
}
}
return injector;
}
Aggregations