Package org.apache.cassandra.utils
Class ReflectionUtils
java.lang.Object
org.apache.cassandra.utils.ReflectionUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> void clearMapField(Class<?> clazz, Object instance, String mapName, Predicate<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 Fieldstatic Field
-
Method Details
-
getModifiersField
- Throws:
NoSuchFieldException
-
getField
- Throws:
NoSuchFieldException
-
clearMapField
public static <K,V> void clearMapField(Class<?> clazz, Object instance, String mapName, Predicate<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
-