Class SharedClassUtilities

java.lang.Object
com.ibm.oti.shared.SharedClassUtilities

public class SharedClassUtilities extends Object
SharedClassUtilities provides APIs to get information about all shared class caches in a directory and to destroy a particular shared class cache.
See Also:
  • Field Details

  • Constructor Details

    • SharedClassUtilities

      @Deprecated public SharedClassUtilities()
      Deprecated.
      Constructs a new instance of this class.
  • Method Details

    • getSharedCacheInfo

      public static List<SharedClassCacheInfo> getSharedCacheInfo(String cacheDir, int flags, boolean useCommandLineValues)
      Iterates through all shared class caches present in the given directory and returns their information in a List.

      If useCommandLineValues is true then use the command line value as the directory to search in. If the command line value is not available, use the platform dependent default value. If useCommandLineValues is false, then use cacheDir as the directory to search in. cacheDir can be null. In such a case, use the platform dependent default value.

      Parameters:
      cacheDir - Absolute path of the directory to look for the shared class caches
      flags - Reserved for future use. Always pass NO_FLAGS
      useCommandLineValues - Use command line values instead of using parameter values
      Returns:
      List of SharedClassCacheInfo corresponding to shared class caches which are present in the specified directory, null on failure.
      Throws:
      IllegalStateException - If shared classes is disabled for this JVM (that is -Xshareclasses:none is present).
      IllegalArgumentException - If flags is not a valid value.
      SecurityException - If a security manager is enabled and the calling thread does not have SharedClassesNamedPermission("getSharedCacheInfo")
    • destroySharedCache

      public static int destroySharedCache(String cacheDir, int cacheType, String cacheName, boolean useCommandLineValues)
      Destroys a named shared class cache of a given type in a given directory. If the shared class cache has multiple layers, this function will destroy the top layer only.

      If useCommandLineValues is true, then use the command line value to get the shared class cache name, its type and its directory. If any of these is not available, then use the default value. If useCommandLineValues is false, then use cacheDir, persistence, and cacheName to identify the cache to be destroyed. To accept the default value for cacheDir or cacheName, specify the parameter with a null value.

      The return value of this method depends on the status of existing current and older generation caches.

      • If it fails to destroy any existing cache with the given name, it returns DESTROYED_NONE.
      • If no cache exists or it is able to destroy all existing caches of all generations, it returns DESTROYED_ALL_CACHE.
      • If it fails to destroy an existing current generation cache, irrespective of the state of older generation caches, it returns DESTROY_FAILED_CURRENT_GEN_CACHE.
      • If it fails to destroy one or more older generation caches, and either a current generation cache does not exist or is successfully destroyed, it returns DESTROY_FAILED_OLDER_GEN_CACHE.
      Parameters:
      cacheDir - Absolute path of the directory where the shared class cache is present
      cacheType - Type of the cache. The type has one of the following values:
      cacheName - Name of the cache to be deleted
      useCommandLineValues - Use command line values instead of using parameter values
      Returns:
      Returns one of the following values:
      Throws:
      IllegalStateException - If shared classes is disabled for this JVM (that is -Xshareclasses:none is present).
      IllegalArgumentException - If cacheType is not a valid value.
      SecurityException - If a security manager is enabled and the calling thread does not have SharedClassesNamedPermission("destroySharedCache")