use of com.yahoo.athenz.instance.provider.InstanceProvider in project athenz by yahoo.
the class InstanceProviderManager method getClassProvider.
InstanceProvider getClassProvider(String className, String providerName) {
final String classKey = className + "-" + providerName;
InstanceProvider provider = providerMap.get(classKey);
if (provider != null) {
return provider;
}
Class<?> instanceClass = null;
try {
instanceClass = Class.forName(className);
} catch (ClassNotFoundException e) {
LOGGER.error("getClassInstance: Provider class {} not found", className);
return null;
}
try {
provider = (InstanceProvider) instanceClass.newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
LOGGER.error("getClassInstance: Unable to get new instance for provider {} error {}", className, ex.getMessage());
return null;
}
provider.initialize(providerName, className, keyStore);
providerMap.put(classKey, provider);
return provider;
}
Aggregations