JNIEXPORT jobject JNICALL
Java_sun_management_MemoryPoolImpl_getUsage0
(JNIEnv *env, jobject pool)
{
jobject usage = jmm_interface->GetMemoryPoolUsage(env, pool);
if (usage == NULL) {
// Throw internal error since this implementation expects the
// pool will never become invalid.
JNU_ThrowInternalError(env, "Memory Pool not found");
}
return usage;
}
This function as well as Java_sun_management_MemoryPoolImpl_getMemoryManagers0, Java_sun_management_MemoryPoolImpl_getPeakUsage0 should propagate the exception that may be returned by the jmm call rather than throw InternalError.