File tree 2 files changed +9
-3
lines changed
agent/src/main/java/org/elasticsearch/entitlement/agent
src/main/java/org/elasticsearch/entitlement/bootstrap
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 25
25
*/
26
26
public class EntitlementAgent {
27
27
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
+ */
28
34
public static void agentmain (String agentArgs , Instrumentation inst ) {
29
35
final Class <?> initClazz ;
30
36
try {
31
- initClazz = Class .forName ("org.elasticsearch.entitlement.initialization.EntitlementInitialization" );
37
+ initClazz = Class .forName (agentArgs );
32
38
} catch (ClassNotFoundException e ) {
33
39
throw new AssertionError ("entitlement agent does could not find EntitlementInitialization" , e );
34
40
}
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ private static void loadAgent(String agentPath) {
138
138
try {
139
139
VirtualMachine vm = VirtualMachine .attach (Long .toString (ProcessHandle .current ().pid ()));
140
140
try {
141
- vm .loadAgent (agentPath );
141
+ vm .loadAgent (agentPath , EntitlementInitialization . class . getName () );
142
142
} finally {
143
143
vm .detach ();
144
144
}
@@ -154,7 +154,7 @@ private static void exportInitializationToAgent() {
154
154
EntitlementInitialization .class .getModule ().addExports (initPkg , unnamedModule );
155
155
}
156
156
157
- private static String findAgentJar () {
157
+ public static String findAgentJar () {
158
158
String propertyName = "es.entitlement.agentJar" ;
159
159
String propertyValue = System .getProperty (propertyName );
160
160
if (propertyValue != null ) {
You can’t perform that action at this time.
0 commit comments