File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
agent/src/main/java/org/elasticsearch/entitlement/agent
src/main/java/org/elasticsearch/entitlement/bootstrap Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 2525 */
2626public class EntitlementAgent {
2727
28+ /**
29+ * The agent main method
30+ * @param agentArgs arguments passed to the agent.For our agent, this is the class to load and use for Entitlement Initialization.
31+ * See e.g. {@code EntitlementsBootstrap#loadAgent}
32+ * @param inst The {@link Instrumentation} instance to use for injecting Entitlements checks
33+ */
2834 public static void agentmain (String agentArgs , Instrumentation inst ) {
2935 final Class <?> initClazz ;
3036 try {
31- initClazz = Class .forName ("org.elasticsearch.entitlement.initialization.EntitlementInitialization" );
37+ initClazz = Class .forName (agentArgs );
3238 } catch (ClassNotFoundException e ) {
3339 throw new AssertionError ("entitlement agent does could not find EntitlementInitialization" , e );
3440 }
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ private static void loadAgent(String agentPath) {
138138 try {
139139 VirtualMachine vm = VirtualMachine .attach (Long .toString (ProcessHandle .current ().pid ()));
140140 try {
141- vm .loadAgent (agentPath );
141+ vm .loadAgent (agentPath , EntitlementInitialization . class . getName () );
142142 } finally {
143143 vm .detach ();
144144 }
@@ -154,7 +154,7 @@ private static void exportInitializationToAgent() {
154154 EntitlementInitialization .class .getModule ().addExports (initPkg , unnamedModule );
155155 }
156156
157- private static String findAgentJar () {
157+ public static String findAgentJar () {
158158 String propertyName = "es.entitlement.agentJar" ;
159159 String propertyValue = System .getProperty (propertyName );
160160 if (propertyValue != null ) {
You can’t perform that action at this time.
0 commit comments