Class MonitoredResourceManager

java.lang.Object
org.zeroturnaround.javarebel.integration.monitor.MonitoredResourceManager

public class MonitoredResourceManager extends Object
This is a helper class that makes it easier to record and reproduce a complicated configuration building process. It keeps track of resources that should trigger the rebuilding of the configuration when updated. The usage pattern follows those steps:
  1. When the configuration building starts, call beginConf(builder), providing the instance responsible for building the configuration as an argument.
  2. During the building process, call registerConf for all the underlying configuration resources that you want to be monitored. (For example, if you are building a Hibernate's SessionFactory with AnnotationConfiguration, you'll be calling registerConf(klass) for all classes containing JPA annotations).
  3. When the configuration building is done, call endConf.
All classes that build such configurations have to implement the Builder interface to be usable together with the MonitoredResourceManager. In normal circumstances, this means we have look up these classes and bytecode-patch them to implement that interface. The main user is currently the Hibernate plugin. See LocalSessionFactoryBeanCBP in the Hibernate plugin for an example usage.
Author:
Jevgeni Kabanov, Rein Raudjärv
  • Constructor Details

    • MonitoredResourceManager

      public MonitoredResourceManager()
  • Method Details

    • beginConf

      public static void beginConf(Object builder)
      When starting to build a configuration, the object that is doing the building has to be set here.
    • endConf

      public static void endConf()
      When the building of the configuration is done, be sure to call endConf() for safety.
    • getConf

      public static Object getConf()
    • modified

      public static Set<String> modified(Object builder)
      Find the MonitoredResourceManager instance that corresponds to that builder. Check for modifications to resources registered to that instance.
      Returns:
      a set of modified resources
    • registerScannedRebelSource

      public static void registerScannedRebelSource(org.zeroturnaround.javarebel.RebelSource rs)
    • getScannedRebelSource

      public static Collection<org.zeroturnaround.javarebel.RebelSource> getScannedRebelSource()
    • registerScannedDir

      public static void registerScannedDir(File dir)
    • getScannedDir

      public static Collection<File> getScannedDir()
    • registerConf

      public static void registerConf(Class<?> klass)
    • registerConf

      public static void registerConf(ClassLoader classLoader, String className)
    • registerConf

      public static void registerConf(URL url)
    • registerConf

      public static void registerConf(String url)
    • registerConf

      public static void registerConf(Class<?> klass, Object builder)
    • registerConf

      public static void registerConf(ClassLoader classLoader, String className, Object builder)
    • registerConf

      public static void registerConf(String url, Object builder)
    • registerConf

      public static void registerConf(URL url, Object builder)
    • confRegistered

      public static boolean confRegistered(String url, Object builder)
      Find the MonitoredResourceManager instance that corresponds to that builder. Checks if the url has already been registered to that instance.
      Returns:
      if the builder has already registered this url.