Class ResourceCache

java.lang.Object
org.jppf.classloader.resource.ResourceCache

public class ResourceCache extends Object
Instances of this class are used as cache for resources downloaded from a driver or client, using the JPPF class loader APIs.
Author:
Laurent Cohen
  • Constructor Details

    • ResourceCache

      public ResourceCache(boolean enabled)
      Default initializations.
      Parameters:
      enabled - whether this cache is enabled.
  • Method Details

    • getResourcesLocations

      public List<org.jppf.location.Location<?>> getResourcesLocations(String name)
      Get the list of locations for the resource with the specified name.
      Parameters:
      name - the name of the resource to lookup.
      Returns:
      a list of file paths, or null if the resource is not found in the cache.
    • getResourcesURLs

      public List<URL> getResourcesURLs(String name)
      Get a list of URLs for the resource with the specified name.
      Parameters:
      name - the name of the resource to lookup.
      Returns:
      a list of URLs, or null if the resource is not found in the cache.
    • getResourceURL

      public URL getResourceURL(String name)
      Get the URL for a cached resource.
      Parameters:
      name - the name of the resource to find.
      Returns:
      resource location expressed as a URL.
    • registerResources

      public void registerResources(String name, List<byte[]> definitions)
      Save the definitions for a resource to temporary files, and register their location with this cache.
      Parameters:
      name - the name of the resource to register.
      definitions - a list of byte array definitions.
    • registerResource

      public void registerResource(String name, org.jppf.location.Location<?> location)
      Register the location of a resource with this cache.
      Parameters:
      name - the name of the resource to register.
      location - a Location object holding or pointing to the resource defintion.
    • close

      public void close()
      Close this resource cache and clean all resources it uses.
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • getUuid

      public String getUuid()
      Get the unique identifier for this resource cache.
      Returns:
      the uuid as a string.
    • getCacheInstance

      public static ResourceCache getCacheInstance(String uuid)
      Get a cache instance form its uuid.
      Parameters:
      uuid - the uuid of the cache to find.
      Returns:
      a ResourceCache instance.
    • isEnabled

      public boolean isEnabled()
      Determine whether this cache is enabled.
      Returns:
      true if this cache is enabled, false otherwise.