use of com.facebook.presto.spi.classloader.ThreadContextClassLoader in project presto by prestodb.
the class FileResourceGroupConfigurationManagerFactory method create.
@Override
public ResourceGroupConfigurationManager create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
Bootstrap app = new Bootstrap(new JsonModule(), new FileResourceGroupsModule(), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));
Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(FileResourceGroupConfigurationManager.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
use of com.facebook.presto.spi.classloader.ThreadContextClassLoader in project presto by prestodb.
the class DbResourceGroupConfigurationManagerFactory method create.
@Override
public ResourceGroupConfigurationManager create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
Bootstrap app = new Bootstrap(new JsonModule(), new DbResourceGroupsModule(), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));
Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(DbResourceGroupConfigurationManager.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
use of com.facebook.presto.spi.classloader.ThreadContextClassLoader in project presto by prestodb.
the class H2ResourceGroupConfigurationManagerFactory method create.
@Override
public ResourceGroupConfigurationManager create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
Bootstrap app = new Bootstrap(new JsonModule(), new H2ResourceGroupsModule(), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));
Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(DbResourceGroupConfigurationManager.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
use of com.facebook.presto.spi.classloader.ThreadContextClassLoader in project carbondata by apache.
the class CarbondataConnectorFactory method create.
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
requireNonNull(config, "config is null");
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
Bootstrap app = new Bootstrap(new JsonModule(), new CarbondataModule(connectorId, context.getTypeManager()));
Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
CarbondataMetadata metadata = injector.getInstance(CarbondataMetadata.class);
ConnectorSplitManager splitManager = injector.getInstance(ConnectorSplitManager.class);
ConnectorRecordSetProvider connectorRecordSet = injector.getInstance(ConnectorRecordSetProvider.class);
ConnectorPageSourceProvider connectorPageSource = injector.getInstance(ConnectorPageSourceProvider.class);
return new CarbondataConnector(lifeCycleManager, metadata, new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader), connectorRecordSet, classLoader, new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader));
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
use of com.facebook.presto.spi.classloader.ThreadContextClassLoader in project carbondata by apache.
the class CarbonTableReader method getCarbonCache.
// for worker node to initialize carbon metastore
public CarbonTableCacheModel getCarbonCache(SchemaTableName table) {
if (!cc.containsKey(table)) {
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(FileFactory.class.getClassLoader())) {
if (carbonFileList == null) {
fileType = FileFactory.getFileType(config.getStorePath());
try {
carbonFileList = FileFactory.getCarbonFile(config.getStorePath(), fileType);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
updateSchemaTables();
parseCarbonMetadata(table);
}
if (cc.containsKey(table))
return cc.get(table);
else
return null;
}
Aggregations