- 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 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.static 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.static 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.static int
DESTROYED_NONE
Returned bydestroySharedCache(java.lang.String, int, java.lang.String, boolean)
to indicate that the method failed to destroy any cache.static int
NO_FLAGS
Value to be passed toflags
parameter of thegetSharedCacheInfo(java.lang.String, int, boolean)
method.static int
NONPERSISTENT
Specifies a non-persistent cache.static int
PERSISTENCE_DEFAULT
Uses the platform dependent default value as the cache type.static int
PERSISTENT
Specifies a persistent cache.static int
SNAPSHOT
Specifies a cache snapshot.
-
Constructor Summary
Constructors Constructor Description SharedClassUtilities()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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 toflags
parameter 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
useCommandLineValues
istrue
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. IfuseCommandLineValues
isfalse
, then usecacheDir
as the directory to search in.cacheDir
can 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_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
- Ifflags
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
istrue
, 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. IfuseCommandLineValues
isfalse
, then usecacheDir
,persistence
, andcacheName
to identify the cache to be destroyed. To accept the default value forcacheDir
orcacheName
, specify the parameter with anull
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 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
- IfcacheType
is 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
-
-