Package org.apache.cassandra.utils
Class ReflectionUtils
- java.lang.Object
-
- org.apache.cassandra.utils.ReflectionUtils
-
public class ReflectionUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
voidclearMapField(java.lang.Class<?> clazz, java.lang.Object instance, java.lang.String mapName, java.util.function.Predicate<java.util.Map.Entry<K,V>> shouldRemove)
Used by the in-jvm dtest framework to remove entries from private map fields that otherwise would prevent collection of classloaders (which causes metaspace OOMs) or otherwise interfere with instance restart.static java.lang.reflect.Field
getField(java.lang.Class<?> clazz, java.lang.String fieldName)
static java.lang.reflect.Field
getModifiersField()
-
-
-
Method Detail
-
getModifiersField
public static java.lang.reflect.Field getModifiersField() throws java.lang.NoSuchFieldException
- Throws:
java.lang.NoSuchFieldException
-
getField
public static java.lang.reflect.Field getField(java.lang.Class<?> clazz, java.lang.String fieldName) throws java.lang.NoSuchFieldException
- Throws:
java.lang.NoSuchFieldException
-
clearMapField
public static <K,V> void clearMapField(java.lang.Class<?> clazz, java.lang.Object instance, java.lang.String mapName, java.util.function.Predicate<java.util.Map.Entry<K,V>> shouldRemove)
Used by the in-jvm dtest framework to remove entries from private map fields that otherwise would prevent collection of classloaders (which causes metaspace OOMs) or otherwise interfere with instance restart.- Type Parameters:
K
- The type of the map keyV
- The type of the map value- Parameters:
clazz
- The class which has the map field to clearinstance
- an instance of the class to clear (pass null for a static member)mapName
- the name of the map field to clearshouldRemove
- a predicate which determines if the entry in question should be removed
-
-