Class PCEnhancerAgent

java.lang.Object
org.apache.openjpa.enhance.PCEnhancerAgent

public class PCEnhancerAgent extends Object

Java agent that makes persistent classes work with OpenJPA at runtime. This is achieved by either running the enhancer on the classes as they are loaded, or by redefining the classes on the fly. The agent is launched at JVM startup from the command line:

java -javaagent:openjpa.jar[=<options>] The options string should be formatted as a OpenJPA plugin, and may contain any properties understood by the OpenJPA enhancer or any configuration properties. For example:

java -javaagent:openjpa.jar

By default, if specified, the agent runs the OpenJPA enhancer on all classes listed in the first persistence unit as they are loaded, and redefines all other persistent classes when they are encountered. To disable enhancement at class-load time and rely solely on the redefinition logic, set the ClassLoadEnhancement flag to false. To disable redefinition and rely solely on pre-deployment or class-load enhancement, set the RuntimeRedefinition flag to false.

java -javaagent:openjpa.jar=ClassLoadEnhancement=false

Author:
Abe White, Patrick Linskey
  • Constructor Details

    • PCEnhancerAgent

      public PCEnhancerAgent()
  • Method Details

    • getLoadSuccessful

      public static boolean getLoadSuccessful()
      Returns:
      True if the Agent has ran successfully. False otherwise.
    • disableDynamicAgent

      public static void disableDynamicAgent()
    • loadDynamicAgent

      public static boolean loadDynamicAgent(Log log)
      Returns:
      True if the agent is loaded successfully
    • premain

      public static void premain(String args, Instrumentation inst)