Search in sources :

Example 1 with HadoopProcessorAdapter

use of org.apache.ignite.internal.processors.hadoop.HadoopProcessorAdapter in project ignite by apache.

the class IgniteKernal method createHadoopComponent.

/**
 * Create Hadoop component.
 *
 * @return Non-null Hadoop component: workable or no-op.
 * @throws IgniteCheckedException If the component is mandatory and cannot be initialized.
 */
private HadoopProcessorAdapter createHadoopComponent() throws IgniteCheckedException {
    boolean mandatory = cfg.getHadoopConfiguration() != null;
    if (mandatory) {
        if (cfg.isPeerClassLoadingEnabled())
            throw new IgniteCheckedException("Hadoop module cannot be used with peer class loading enabled " + "(set IgniteConfiguration.peerClassLoadingEnabled to \"false\").");
        HadoopProcessorAdapter res = IgniteComponentType.HADOOP.createIfInClassPath(ctx, true);
        res.validateEnvironment();
        return res;
    } else {
        HadoopProcessorAdapter cmp = null;
        if (!ctx.hadoopHelper().isNoOp() && cfg.isPeerClassLoadingEnabled()) {
            U.warn(log, "Hadoop module is found in classpath, but will not be started because peer class " + "loading is enabled (set IgniteConfiguration.peerClassLoadingEnabled to \"false\" if you want " + "to use Hadoop module).");
        } else {
            cmp = IgniteComponentType.HADOOP.createIfInClassPath(ctx, false);
            try {
                cmp.validateEnvironment();
            } catch (IgniteException | IgniteCheckedException e) {
                U.quietAndWarn(log, "Hadoop module will not start due to exception: " + e.getMessage());
                cmp = null;
            }
        }
        if (cmp == null)
            cmp = IgniteComponentType.HADOOP.create(ctx, true);
        return cmp;
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) HadoopProcessorAdapter(org.apache.ignite.internal.processors.hadoop.HadoopProcessorAdapter) IgniteException(org.apache.ignite.IgniteException)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 HadoopProcessorAdapter (org.apache.ignite.internal.processors.hadoop.HadoopProcessorAdapter)1