Search in sources :

Example 1 with HBaseTableFactory

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;
}
Also used : LogAppenderInitializer(co.cask.cdap.logging.appender.LogAppenderInitializer) HBaseTableFactory(co.cask.cdap.messaging.store.hbase.HBaseTableFactory) ForwardingTableFactory(co.cask.cdap.messaging.store.ForwardingTableFactory) TableFactory(co.cask.cdap.messaging.store.TableFactory) HBaseTableFactory(co.cask.cdap.messaging.store.hbase.HBaseTableFactory) IOException(java.io.IOException) ServiceLoggingContext(co.cask.cdap.common.logging.ServiceLoggingContext) CConfiguration(co.cask.cdap.common.conf.CConfiguration)

Aggregations

CConfiguration (co.cask.cdap.common.conf.CConfiguration)1 ServiceLoggingContext (co.cask.cdap.common.logging.ServiceLoggingContext)1 LogAppenderInitializer (co.cask.cdap.logging.appender.LogAppenderInitializer)1 ForwardingTableFactory (co.cask.cdap.messaging.store.ForwardingTableFactory)1 TableFactory (co.cask.cdap.messaging.store.TableFactory)1 HBaseTableFactory (co.cask.cdap.messaging.store.hbase.HBaseTableFactory)1 IOException (java.io.IOException)1