Skip to content

Commit

Permalink
Prevent the runtime attachment from launching multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbisutti committed Jul 21, 2022
1 parent 4ff617e commit b31b1fa
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public final class CoreRuntimeAttach {

private final String agentJarResourceName;

private boolean runtimeAttachmentRequested;

/**
* Creates a new {@code DistroRuntimeAttach} from the resource name of the agent jar.
*
Expand All @@ -37,6 +39,11 @@ public void attachJavaagentToCurrentJVM() {
return;
}

if (runtimeAttachmentRequested) {
return;
}
runtimeAttachmentRequested = true;

AgentFileProvider agentFileProvider = new AgentFileProvider(agentJarResourceName);

File javaagentFile = agentFileProvider.getAgentFile();
Expand Down

0 comments on commit b31b1fa

Please sign in to comment.