use of io.cdap.cdap.data.runtime.ConstantTransactionSystemClient in project cdap by caskdata.
the class DistributedProgramContainerModule method addDataFabricModules.
/**
* Adds guice modules that are related to data fabric.
*/
private void addDataFabricModules(List<Module> modules) {
if (cConf.getBoolean(Constants.Transaction.TX_ENABLED)) {
String instanceId = programOpts.getArguments().getOption(ProgramOptionConstants.INSTANCE_ID);
modules.add(new DataFabricModules(generateClientId(programRunId, instanceId)).getDistributedModules());
modules.add(new SystemDatasetRuntimeModule().getDistributedModules());
} else {
modules.add(new DataSetServiceModules().getStandaloneModules());
modules.add(Modules.override(new DataFabricModules().getInMemoryModules()).with(new AbstractModule() {
@Override
protected void configure() {
// Use the ConstantTransactionSystemClient in isolated mode, basically there is no transaction.
bind(TransactionSystemClient.class).to(ConstantTransactionSystemClient.class).in(Scopes.SINGLETON);
}
}));
}
if (cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED)) {
modules.add(new AbstractModule() {
@Override
protected void configure() {
// bind explore client to ProgramDiscoveryExploreClient which is aware of the programId
bind(ExploreClient.class).to(ProgramDiscoveryExploreClient.class).in(Scopes.SINGLETON);
}
});
} else {
modules.add(new AbstractModule() {
@Override
protected void configure() {
// Bind to unsupported/no-op class implementations
bind(ExploreClient.class).to(UnsupportedExploreClient.class);
}
});
}
}
Aggregations