org.broadleafcommerce.common.extensibility
Class InstrumentationRuntimeFactory

java.lang.Object
  extended by org.broadleafcommerce.common.extensibility.InstrumentationRuntimeFactory

public class InstrumentationRuntimeFactory
extends Object

This class is based on the OpenJPA's org.apache.openjpa.enhance.InstrumentationFactory. It essentially does its best to install an instrumentation agent. The preferred or prescribed way to install an instrumentation agent is to add the agent as an argument on the command line when starting the JVM. This class attempts to do the same thing after the JVM has already started. Unfortunately, this is the only way we know of to attach an agent to the JVM except by adding a "javaagent:..." flag on the command line. User: Kelly Tisdell


Constructor Summary
InstrumentationRuntimeFactory()
           
 
Method Summary
static void agentmain(String agentArgs, Instrumentation instrumentation)
          This method is called by the JVM to set the instrumentation.
static Instrumentation getInstrumentation()
          This method returns the Instrumentation object provided by the JVM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstrumentationRuntimeFactory

public InstrumentationRuntimeFactory()
Method Detail

agentmain

public static void agentmain(String agentArgs,
                             Instrumentation instrumentation)
This method is called by the JVM to set the instrumentation. We can't synchronize this because it will cause a deadlock with the thread calling the getInstrumentation() method when the instrumentation is installed.

Parameters:
agentArgs -
instrumentation -

getInstrumentation

public static Instrumentation getInstrumentation()
This method returns the Instrumentation object provided by the JVM. If the Instrumentation object is null, it does its best to add an instrumentation agent to the JVM and then the instrumentation object.

Returns:
Instrumentation


Copyright © 2012. All Rights Reserved.