org.apache.ignite.internal.processors.hadoop

## Class HadoopClassLoader

- java.lang.Object
- - java.lang.ClassLoader
  - - java.security.SecureClassLoader
    - - java.net.URLClassLoader
      - - org.apache.ignite.internal.processors.hadoop.HadoopClassLoader

All Implemented Interfaces:
  Closeable, AutoCloseable, ClassCache

    public class HadoopClassLoader
    extends URLClassLoader
    implements ClassCache

Class loader allowing explicitly load classes without delegation to parent class loader. Also supports class parsing for finding dependencies which contain transitive dependencies unavailable for parent.

### Field Summary

Fields
`static String` `CLS_DAEMON` Hadoop class name: Daemon.
`static String` `CLS_DAEMON_REPLACE` Hadoop class name: Daemon replacement.
`static String` `CLS_SHUTDOWN_HOOK_MANAGER` Hadoop class name: ShutdownHookManager.
`static String` `CLS_SHUTDOWN_HOOK_MANAGER_REPLACE` Hadoop class name: ShutdownHookManager replacement.

### Constructor Summary

Constructors
Constructor and Description
`HadoopClassLoader(URL[] urls, String name, String[] libNames, HadoopHelper helper)` Constructor.

### Method Summary

Methods
`Class<?>` `getFromCache(String clsName)` Get class for the given name.
`static Collection<URL>` `hadoopUrls()`
`static boolean` `loadByCurrentClassloader(String clsName)` Check whether file must be loaded with current class loader, or normal delegation model should be used.
`protected Class<?>` `loadClass(String name, boolean resolve)`
`String` `name()` Getter for name field.
`static String` `nameForTask(HadoopTaskInfo info, boolean prefix)` Gets name for the task class loader.
`String` `toString()`

### Methods inherited from class java.net.URLClassLoader

`addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance`

### Methods inherited from class java.security.SecureClassLoader

`defineClass, defineClass`

### Methods inherited from class java.lang.ClassLoader

`clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### CLS_DAEMON

    public static final String CLS_DAEMON

Hadoop class name: Daemon.

See Also:
  Constant Field Values

#### CLS_SHUTDOWN_HOOK_MANAGER

    public static final String CLS_SHUTDOWN_HOOK_MANAGER

Hadoop class name: ShutdownHookManager.

See Also:
  Constant Field Values

#### CLS_DAEMON_REPLACE

    public static final String CLS_DAEMON_REPLACE

Hadoop class name: Daemon replacement.

See Also:
  Constant Field Values

#### CLS_SHUTDOWN_HOOK_MANAGER_REPLACE

    public static final String CLS_SHUTDOWN_HOOK_MANAGER_REPLACE

Hadoop class name: ShutdownHookManager replacement.

See Also:
  Constant Field Values

### Constructor Detail

#### HadoopClassLoader

    public HadoopClassLoader(URL[] urls,
                     String name,
                     @Nullable
                     String[] libNames,
                     HadoopHelper helper)

Constructor.

Parameters:
  `urls` - Urls.
  `name` - Classloader name.
  `libNames` - Optional additional native library names to be linked from parent classloader.

### Method Detail

#### nameForTask

    public static String nameForTask(HadoopTaskInfo info,
                     boolean prefix)

Gets name for the task class loader. Task class loader

Parameters:
  `info` - The task info.
  `prefix` - Get only prefix (without task type and number)
Returns:
  The class loader name.

#### loadClass

    protected Class<?> loadClass(String name,
                     boolean resolve)
                          throws ClassNotFoundException

Overrides:
  `loadClass` in class `ClassLoader`
Throws:
  `ClassNotFoundException`

#### getFromCache

    public Class<?> getFromCache(String clsName)
                          throws ClassNotFoundException

Get class for the given name.

Specified by:
  `getFromCache` in interface `ClassCache`
Parameters:
  `clsName` - Class name.
Returns:
  Class.
Throws:
  `ClassNotFoundException` - If not found.

#### loadByCurrentClassloader

    public static boolean loadByCurrentClassloader(String clsName)

Check whether file must be loaded with current class loader, or normal delegation model should be used.

Override is only necessary for Ignite classes which have direct or transitive dependencies on Hadoop classes. These are all classes from "org.apache.ignite.internal.processors.hadoop.impl" package, and these are several well-know classes from "org.apache.ignite.hadoop" package.

Parameters:
  `clsName` - Class name.
Returns:
  Whether class must be loaded by current classloader without delegation.

#### hadoopUrls

    public static Collection<URL> hadoopUrls()
                                      throws IgniteCheckedException

Returns:
  Collection of jar URLs.
Throws:
  `IgniteCheckedException` - If failed.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### name

    public String name()

Getter for name field.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.8.0
Release Date | : December 5 2016