IBM User Guide for Java V7 on Windows > Troubleshooting and support > Using diagnostic tools > Using the JVMTI > IBM JVMTI extensions - API reference



Finding shared class caches

You can search for caches using the IterateSharedCaches() API.


IterateSharedCaches()

The IterateSharedCaches() API has the JVMTI Extension Function identifier com.ibm.IterateSharedCaches. The identifier is declared as macro COM_IBM_ITERATE_SHARED_CACHES in ibmjvmti.h.

To search for shared class caches that exist in a specified cache directory use:

jvmtiError IterateSharedCaches(jvmtiEnv* env, jint version, const char *cacheDir, 
jint flags, jboolean useCommandLineValues, jvmtiIterateSharedCachesCallback 
callback, void *user_data);
This extension searches for shared class caches in a specified directory. Information about the caches is returned in a structure that is populated by a user specified callback function. You can specify the search directory by either:

Parameters:

env: A pointer to the JVMTI environment.

version: Version information for IterateSharedCaches, which describes the jvmtiSharedCacheInfo structure passed to the jvmtiIterateSharedCachesCallback function. The only value allowed is COM_IBM_ITERATE_SHARED_CACHES_VERSION_1.

cacheDir: When the value of useCommandLineValues is false, specify the absolute path of the directory for the shared class cache. If the value is null, the platform-dependent default is used.

flags: Reserved for future use. The only value allowed is COM_IBM_ITERATE_SHARED_CACHES_NO_FLAGS.

useCommandLineValues: Set this value to true when you want to specify the cache directory on the command line. Set this value to false when you want to use the cacheDir parameter.

callback: A function pointer to a user provided callback routine jvmtiIterateSharedCachesCallback.

user_data: User supplied data, passed as an argument to the callback function.
jint (JNICALL *jvmtiIterateSharedCachesCallback)(jvmtiEnv *env,jvmtiSharedCacheInfo 
*cache_info, void *user_data);

Returns:

JVMTI_ERROR_NONE: Success.

JVMTI_ERROR_OUT_OF_MEMORY: There is insufficient system memory to process the request.

JVMTI_ERROR_INVALID_ENVIRONMENT: The env parameter is not valid.

JVMTI_ERROR_WRONG_PHASE: The extension has been called outside the JVMTI live phase.

JVMTI_ERROR_UNSUPPORTED_VERSION: The version parameter is not valid.

JVMTI_ERROR_NULL_POINTER: The callback parameter is NULL.

JVMTI_ERROR_NOT_AVAILABLE: The shared classes feature is not enabled in the JVM.

JVMTI_ERROR_ILLEGAL_ARGUMENT: The flags parameter is not valid.

JVMTI_ERROR_INTERNAL: This error is returned when the jvmtiIterateSharedCachesCallback returns JNI_ERR.


jvmtiIterateSharedCachesCallback function

The jvmtiIterateSharedCachesCallback function is called with the following parameters:

Parameters:

env: A pointer to the JVMTI environment when calling COM_IBM_ITERATE_SHARED_CACHES.

cache_info: A jvmtiSharedCacheInfo structure containing information about a shared cache.

user_data: User supplied data, passed as an argument to IterateSharedCaches.

The following values are returned by the jvmtiIterateSharedCachesCallback function.

Returns:

JNI_OK: Continue iterating.

JNI_ERR: Stop iterating, which causes IterateSharedCaches to return JVMTI_ERROR_INTERNAL


jvmtiSharedCacheInfo structure

The structure of jvmtiSharedCacheInfo:

typedef struct jvmtiSharedCacheInfo {
const char *name; - the name of the shared cache
jboolean isCompatible; - if the shared cache is compatible with this JVM
jboolean isPersistent; - true if the shared cache is persistent, false if its non-persistent
jint os_shmid; - the OS shared memory ID associated with a non-persistent cache, -1 otherwise
jint os_semid; - the OS shared semaphore ID associated with a non-persistent cache, -1 otherwise
jint modLevel; - one of COM_IBM_SHARED_CACHE_MODLEVEL_JAVA5, COM_IBM_SHARED_CACHE_MODLEVEL_JAVA6, 
COM_IBM_SHARED_CACHE_MODLEVEL_JAVA7
jint addrMode; - one of COM_IBM_SHARED_CACHE_ADDRMODE_32, COM_IBM_SHARED_CACHE_ADDRMODE_64
jboolean isCorrupt; - if the cache is corrupted
jlong cacheSize; - the total usable shared class cache size, or -1 when isCompatible is false
jlong freeBytes; - the amount of free bytes in the shared class cache, or -1 when isCompatible is false
jlong lastDetach; - the last detach tiime specified in milliseconds since 00:00:00 on January 1, 1970 UTC.} jvmtiSharedCacheInfo;


Parent: IBM JVMTI extensions - API reference








Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.