Class ReflectionUtils

java.lang.Object
org.apache.cassandra.utils.ReflectionUtils

public class ReflectionUtils extends Object
  • Method Details

    • getModifiersField

      public static Field getModifiersField() throws NoSuchFieldException
      Throws:
      NoSuchFieldException
    • getField

      public static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException
      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 key
      V - The type of the map value
      Parameters:
      clazz - The class which has the map field to clear
      instance - an instance of the class to clear (pass null for a static member)
      mapName - the name of the map field to clear
      shouldRemove - a predicate which determines if the entry in question should be removed