1 19 package org.apache.cayenne.instrument; 20 21 import java.lang.instrument.Instrumentation ; 22 import java.lang.reflect.Method ; 23 24 30 public class CayenneInstrumentationFactory implements InstrumentationFactory { 31 32 static final String AGENT_CLASS = "org.apache.cayenne.instrument.CayenneAgent"; 33 34 public Instrumentation getInstrumentation() { 35 try { 36 Class agent = Class.forName(AGENT_CLASS, false, Thread 37 .currentThread() 38 .getContextClassLoader()); 39 40 Method getInstrumentation = agent.getDeclaredMethod("getInstrumentation"); 41 return (Instrumentation ) getInstrumentation.invoke(null); 42 } 43 catch (Throwable th) { 44 return null; 45 } 46 } 47 } 48 | Popular Tags |