Class InstrumentationDeployer

java.lang.Object
rife.instrument.InstrumentationDeployer

public class InstrumentationDeployer extends Object
Applies RIFE2's bytecode instrumentation ahead of time to compiled classes, as an alternative to the java agent that performs the same transformations at class loading time.

The same transformations are applied in the same order as the agent: web engine continuations, workflow continuations, meta-data merging, and lazy-loading of GenericQueryManager relationships. Classes that don't use any of these capabilities are left untouched, and instrumenting already instrumented classes makes no changes, so the agent can still be active at run time, for instance during development.

Ahead-of-time instrumented classes make the agent unnecessary at run time, and they are the way to use continuations, the workflow engine and meta-data merging inside a GraalVM native image, where load-time instrumentation isn't possible. For every class that received continuations support, a GraalVM reflection configuration entry is written alongside the classes, so that native images can invoke their entry methods.

Since:
1.10
  • Constructor Details

    • InstrumentationDeployer

      public InstrumentationDeployer()
  • Method Details

    • instrument

      public static List<String> instrument(List<File> classDirectories, File targetDirectory, boolean verbose) throws Exception
      Instruments the classes of the provided directories into a target directory.

      Only the classes that were modified are written to the target directory, which can be the same directory as the one that is being instrumented. When classes received continuations support, their GraalVM reflection configuration is written to META-INF/native-image/rife-instrumented/reflect-config.json in the target directory.

      Parameters:
      classDirectories - the directories with the compiled classes to instrument
      targetDirectory - the directory the instrumented classes are written to
      verbose - whether every instrumented class is reported on the standard output
      Returns:
      the names of the classes that were instrumented
      Throws:
      Exception - when an error occurred during the instrumentation
      Since:
      1.10
    • main

      public static void main(String[] arguments)