- 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:
SharedClassCacheInfo
-
-
Field Summary
Fields Modifier and Type Field Description static intDESTROY_FAILED_CURRENT_GEN_CACHEReturned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate that the method has failed to destroy the current generation cache.static intDESTROY_FAILED_OLDER_GEN_CACHEReturned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate that the method has failed to destroy one or more older generation caches, and either a current generation cache does not exist or is successfully destroyed.static intDESTROYED_ALL_CACHEReturned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate either no cache exists or the method has successfully destroyed caches of all generations.static intDESTROYED_NONEReturned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate that the method failed to destroy any cache.static intNO_FLAGSValue to be passed toflagsparameter of thegetSharedCacheInfo(java.lang.String, int, boolean)method.static intNONPERSISTENTSpecifies a non-persistent cache.static intPERSISTENCE_DEFAULTUses the platform dependent default value as the cache type.static intPERSISTENTSpecifies a persistent cache.static intSNAPSHOTSpecifies a cache snapshot.
-
Constructor Summary
Constructors Constructor Description SharedClassUtilities()Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intdestroySharedCache(String cacheDir, int cacheType, String cacheName, boolean useCommandLineValues)Destroys a named shared class cache of a given type in a given directory.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 aList.
-
-
-
Field Detail
-
NO_FLAGS
public static final int NO_FLAGS
Value to be passed toflagsparameter of thegetSharedCacheInfo(java.lang.String, int, boolean)method.- See Also:
- Constant Field Values
-
PERSISTENCE_DEFAULT
public static final int PERSISTENCE_DEFAULT
Uses the platform dependent default value as the cache type.- See Also:
- Constant Field Values
-
PERSISTENT
public static final int PERSISTENT
Specifies a persistent cache.- See Also:
- Constant Field Values
-
NONPERSISTENT
public static final int NONPERSISTENT
Specifies a non-persistent cache.- See Also:
- Constant Field Values
-
SNAPSHOT
public static final int SNAPSHOT
Specifies a cache snapshot.- See Also:
- Constant Field Values
-
DESTROYED_ALL_CACHE
public static final int DESTROYED_ALL_CACHE
Returned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate either no cache exists or the method has successfully destroyed caches of all generations.- See Also:
- Constant Field Values
-
DESTROYED_NONE
public static final int DESTROYED_NONE
Returned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate that the method failed to destroy any cache.- See Also:
- Constant Field Values
-
DESTROY_FAILED_CURRENT_GEN_CACHE
public static final int DESTROY_FAILED_CURRENT_GEN_CACHE
Returned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate that the method has failed to destroy the current generation cache.- See Also:
- Constant Field Values
-
DESTROY_FAILED_OLDER_GEN_CACHE
public static final int DESTROY_FAILED_OLDER_GEN_CACHE
Returned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)to indicate that the method has failed to destroy one or more older generation caches, and either a current generation cache does not exist or is successfully destroyed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SharedClassUtilities
@Deprecated public SharedClassUtilities()
Deprecated.Constructs a new instance of this class.
-
-
Method Detail
-
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 aList.If
useCommandLineValuesistruethen 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. IfuseCommandLineValuesisfalse, then usecacheDiras the directory to search in.cacheDircan benull. In such a case, use the platform dependent default value.- Parameters:
cacheDir- Absolute path of the directory to look for the shared class cachesflags- Reserved for future use. Always passNO_FLAGSuseCommandLineValues- Use command line values instead of using parameter values- Returns:
- List of
SharedClassCacheInfocorresponding to shared class caches which are present in the specified directory,nullon failure. - Throws:
IllegalStateException- If shared classes is disabled for this JVM (that is -Xshareclasses:none is present).IllegalArgumentException- Ifflagsis 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
useCommandLineValuesistrue, 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. IfuseCommandLineValuesisfalse, then usecacheDir,persistence, andcacheNameto identify the cache to be destroyed. To accept the default value forcacheDirorcacheName, specify the parameter with anullvalue.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 presentcacheType- Type of the cache. The type has one of the following values:cacheName- Name of the cache to be deleteduseCommandLineValues- 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- IfcacheTypeis not a valid value.SecurityException- If a security manager is enabled and the calling thread does not have SharedClassesNamedPermission("destroySharedCache")
- If it fails to destroy any existing cache with the given name, it returns
-
-