public final class LibraryCacheManager extends Object
This class is thread-safe.
| Modifier and Type | Method and Description |
|---|---|
static void |
addLibrary(JobID jobID,
Path name,
long size,
DataInput in)
Reads a library from the given input stream and adds it to the local library cache.
|
static Path |
contains(String cacheName)
Checks if the given library is in the local cache.
|
static ClassLoader |
getClassLoader(JobID id)
Returns the class loader to the specified vertex.
|
static String[] |
getRequiredJarFiles(JobID id)
Returns the names of the required libraries of the specified job.
|
static void |
readLibraryFromStream(DataInput in)
Reads library data from the given stream.
|
static void |
register(JobID id,
Path[] clientPaths)
Registers a job ID with a set of library paths that are required to run the job.
|
static void |
register(JobID id,
String[] requiredJarFiles)
Registers a job ID with a set of library paths that are required to run the job.
|
static void |
unregister(JobID id)
Unregisters a job ID and releases the resources associated with it.
|
static void |
writeLibraryToStream(String libraryFileName,
DataOutput out)
Writes data from the library with the given file name to the specified stream.
|
public static void register(JobID id, Path[] clientPaths) throws IOException
id - the ID of the job to be registeredclientPaths - the client path's of the required librariesIOException - thrown if the library cache manager could not be instantiated, no mapping between the job ID and a job ID
exists or the requested library is not in the cache.public static void register(JobID id, String[] requiredJarFiles) throws IOException
id - the ID of the job to be registered.clientPaths - the client path's of the required librariesIOException - thrown if the library cache manager could not be instantiated or one of the requested libraries is not in
the cachepublic static void unregister(JobID id) throws IOException
id - the job ID to unregisterIOException - thrown if the library cache manager could not be instantiatedpublic static Path contains(String cacheName) throws IOException
cacheName - The name of the library to be checked for.null otherwiseIOException - thrown if the library cache manager could not be instantiated or no access to the file system could be
obtainedpublic static ClassLoader getClassLoader(JobID id) throws IOException
id - the ID of the job to return the class loader fornull if no class loader has been registered with the
given ID.IOException - thrown if the library cache manager could not be instantiatedpublic static String[] getRequiredJarFiles(JobID id) throws IOException
id - the ID of the job to return the names of required libraries for.null if the specified job ID is unknownIOException - thrown if the library cache manager could not be instantiatedpublic static void writeLibraryToStream(String libraryFileName, DataOutput out) throws IOException
libraryFileName - the name of the libraryout - the stream to write the data toIOException - thrown if an error occurs while writing the datapublic static void readLibraryFromStream(DataInput in) throws IOException
in - the stream to read the library data fromIOException - throws if an error occurs while reading from the streampublic static void addLibrary(JobID jobID, Path name, long size, DataInput in) throws IOException
jobID - the ID of the job the library data belongs toname - the name of the library at the clients hostsize - the size of the library to be read from the input streamin - the data input streamIOException - thrown if the library cache manager could not be instantiated or an error occurred while reading the
library data from the input streamCopyright © 2014 The Apache Software Foundation. All rights reserved.