use of org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider in project hadoop by apache.
the class Cluster method initialize.
private void initialize(InetSocketAddress jobTrackAddr, Configuration conf) throws IOException {
initProviderList();
final IOException initEx = new IOException("Cannot initialize Cluster. Please check your configuration for " + MRConfig.FRAMEWORK_NAME + " and the correspond server addresses.");
if (jobTrackAddr != null) {
LOG.info("Initializing cluster for Job Tracker=" + jobTrackAddr.toString());
}
for (ClientProtocolProvider provider : providerList) {
LOG.debug("Trying ClientProtocolProvider : " + provider.getClass().getName());
ClientProtocol clientProtocol = null;
try {
if (jobTrackAddr == null) {
clientProtocol = provider.create(conf);
} else {
clientProtocol = provider.create(jobTrackAddr, conf);
}
if (clientProtocol != null) {
clientProtocolProvider = provider;
client = clientProtocol;
LOG.debug("Picked " + provider.getClass().getName() + " as the ClientProtocolProvider");
break;
} else {
LOG.debug("Cannot pick " + provider.getClass().getName() + " as the ClientProtocolProvider - returned null protocol");
}
} catch (Exception e) {
final String errMsg = "Failed to use " + provider.getClass().getName() + " due to error: ";
initEx.addSuppressed(new IOException(errMsg, e));
LOG.info(errMsg, e);
}
}
if (null == clientProtocolProvider || null == client) {
throw initEx;
}
}
use of org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider in project hadoop by apache.
the class Cluster method initProviderList.
private void initProviderList() {
if (providerList == null) {
synchronized (frameworkLoader) {
if (providerList == null) {
List<ClientProtocolProvider> localProviderList = new ArrayList<ClientProtocolProvider>();
try {
for (ClientProtocolProvider provider : frameworkLoader) {
localProviderList.add(provider);
}
} catch (ServiceConfigurationError e) {
LOG.info("Failed to instantiate ClientProtocolProvider, please " + "check the /META-INF/services/org.apache." + "hadoop.mapreduce.protocol.ClientProtocolProvider " + "files on the classpath", e);
}
providerList = localProviderList;
}
}
}
}
Aggregations