use of io.cdap.cdap.app.runtime.ProgramRuntimeProvider in project cdap by caskdata.
the class ProgramRuntimeProviderLoader method getSupportedTypesForProvider.
@Override
public Set<ProgramType> getSupportedTypesForProvider(ProgramRuntimeProvider programRuntimeProvider) {
// See if the provide supports the required program type
ProgramRuntimeProvider.SupportedProgramType supportedTypes = programRuntimeProvider.getClass().getAnnotation(ProgramRuntimeProvider.SupportedProgramType.class);
ImmutableSet.Builder<ProgramType> types = ImmutableSet.builder();
for (ProgramType programType : supportedTypes.value()) {
if (programRuntimeProvider.isSupported(programType, cConf)) {
types.add(programType);
}
}
return types.build();
}
use of io.cdap.cdap.app.runtime.ProgramRuntimeProvider in project cdap by caskdata.
the class DefaultProgramRunnerFactory method create.
@Override
public ProgramRunner create(ProgramType programType) {
ProgramRuntimeProvider provider = runtimeProviderLoader.get(programType);
ProgramRunner runner;
if (provider != null) {
LOG.trace("Using runtime provider {} for program type {}", provider, programType);
runner = provider.createProgramRunner(programType, mode, injector);
} else {
Provider<ProgramRunner> defaultProvider = defaultRunnerProviders.get(programType);
if (defaultProvider == null) {
throw new IllegalArgumentException("Unsupported program type: " + programType);
}
runner = defaultProvider.get();
}
// In distributed mode, program state changes are recorded in the event handler by Twill AM.
return (mode == ProgramRuntimeProvider.Mode.LOCAL || publishProgramState) ? wrapProgramRunner(runner) : runner;
}
Aggregations