Search in sources :

Example 1 with ClientProtocolProvider

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;
    }
}
Also used : IOException(java.io.IOException) ClientProtocol(org.apache.hadoop.mapreduce.protocol.ClientProtocol) ClientProtocolProvider(org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Example 2 with ClientProtocolProvider

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;
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ServiceConfigurationError(java.util.ServiceConfigurationError) ClientProtocolProvider(org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider)

Aggregations

ClientProtocolProvider (org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ServiceConfigurationError (java.util.ServiceConfigurationError)1 ClientProtocol (org.apache.hadoop.mapreduce.protocol.ClientProtocol)1