Skip to content

Commit

Permalink
Merge branch '1.13.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
shakuzen committed Nov 11, 2024
2 parents 269fab3 + 3ebc09f commit 7c24181
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class HazelcastIMapAdapter {

private static final InternalLogger log = InternalLoggerFactory.getInstance(HazelcastIMapAdapter.class);

private static final Class<?> CLASS_DISTRIBUTED_OBJECT = resolveClass("com.hazelcast.core.DistributedObject");

private static final Class<?> CLASS_I_MAP = resolveOneOf("com.hazelcast.map.IMap", "com.hazelcast.core.IMap");

private static final Class<?> CLASS_LOCAL_MAP = resolveOneOf("com.hazelcast.map.LocalMapStats",
Expand All @@ -50,8 +52,8 @@ class HazelcastIMapAdapter {
private static final MethodHandle GET_LOCAL_MAP_STATS;

static {
GET_NAME = resolveIMapMethod("getName", methodType(String.class));
GET_LOCAL_MAP_STATS = resolveIMapMethod("getLocalMapStats", methodType(CLASS_LOCAL_MAP));
GET_NAME = resolveMethod(CLASS_DISTRIBUTED_OBJECT, "getName", methodType(String.class));
GET_LOCAL_MAP_STATS = resolveMethod(CLASS_I_MAP, "getLocalMapStats", methodType(CLASS_LOCAL_MAP));
}

private final WeakReference<Object> cache;
Expand Down Expand Up @@ -252,9 +254,9 @@ private static MethodHandle resolveMethod(String name, MethodType mt) {

}

private static MethodHandle resolveIMapMethod(String name, MethodType mt) {
private static MethodHandle resolveMethod(Class<?> clazz, String name, MethodType mt) {
try {
return MethodHandles.publicLookup().findVirtual(CLASS_I_MAP, name, mt);
return MethodHandles.publicLookup().findVirtual(clazz, name, mt);
}
catch (NoSuchMethodException | IllegalAccessException e) {
throw new IllegalStateException(e);
Expand All @@ -266,12 +268,16 @@ private static Class<?> resolveOneOf(String class1, String class2) {
return Class.forName(class1);
}
catch (ClassNotFoundException e) {
try {
return Class.forName(class2);
}
catch (ClassNotFoundException ex) {
throw new IllegalStateException(ex);
}
return resolveClass(class2);
}
}

private static Class<?> resolveClass(String clazz) {
try {
return Class.forName(clazz);
}
catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,71 @@
{
"name":"org.HdrHistogram.Histogram",
"methods":[{"name":"<init>","parameterTypes":["long","long","int"] }]
},
{
"name":"com.hazelcast.core.DistributedObject",
"methods":[{"name":"getName","parameterTypes":[] }]
},
{
"name":"com.hazelcast.map.IMap",
"methods":[{"name":"getLocalMapStats","parameterTypes":[] }]
},
{
"name":"com.hazelcast.core.IMap",
"methods":[{"name":"getLocalMapStats","parameterTypes":[] }]
},
{
"name":"com.hazelcast.map.LocalMapStats",
"methods":[
{"name":"getNearCacheStats","parameterTypes":[] },
{"name":"getOwnedEntryCount","parameterTypes":[] },
{"name":"getHits","parameterTypes":[] },
{"name":"getPutOperationCount","parameterTypes":[] },
{"name":"getSetOperationCount","parameterTypes":[] },
{"name":"getBackupEntryCount","parameterTypes":[] },
{"name":"getBackupEntryMemoryCost","parameterTypes":[] },
{"name":"getOwnedEntryMemoryCost","parameterTypes":[] },
{"name":"getGetOperationCount","parameterTypes":[] },
{"name":"getTotalGetLatency","parameterTypes":[] },
{"name":"getTotalPutLatency","parameterTypes":[] },
{"name":"getRemoveOperationCount","parameterTypes":[] },
{"name":"getTotalRemoveLatency","parameterTypes":[] }
]
},
{
"name":"com.hazelcast.monitor.LocalMapStats",
"methods":[
{"name":"getNearCacheStats","parameterTypes":[] },
{"name":"getOwnedEntryCount","parameterTypes":[] },
{"name":"getHits","parameterTypes":[] },
{"name":"getPutOperationCount","parameterTypes":[] },
{"name":"getSetOperationCount","parameterTypes":[] },
{"name":"getBackupEntryCount","parameterTypes":[] },
{"name":"getBackupEntryMemoryCost","parameterTypes":[] },
{"name":"getOwnedEntryMemoryCost","parameterTypes":[] },
{"name":"getGetOperationCount","parameterTypes":[] },
{"name":"getTotalGetLatency","parameterTypes":[] },
{"name":"getTotalPutLatency","parameterTypes":[] },
{"name":"getRemoveOperationCount","parameterTypes":[] },
{"name":"getTotalRemoveLatency","parameterTypes":[] }
]
},
{
"name":"com.hazelcast.nearcache.NearCacheStats",
"methods":[
{"name":"getHits","parameterTypes":[] },
{"name":"getMisses","parameterTypes":[] },
{"name":"getEvictions","parameterTypes":[] },
{"name":"getPersistenceCount","parameterTypes":[] }
]
},
{
"name":"com.hazelcast.monitor.NearCacheStats",
"methods":[
{"name":"getHits","parameterTypes":[] },
{"name":"getMisses","parameterTypes":[] },
{"name":"getEvictions","parameterTypes":[] },
{"name":"getPersistenceCount","parameterTypes":[] }
]
}
]

0 comments on commit 7c24181

Please sign in to comment.