detectInstalledAgent checks if JVMKill was previously installed and sets agentPath
()
| 113 | |
| 114 | // detectInstalledAgent checks if JVMKill was previously installed and sets agentPath |
| 115 | func (j *JVMKillAgent) detectInstalledAgent() { |
| 116 | binDir := filepath.Join(j.jreDir, "bin") |
| 117 | |
| 118 | // Try to find jvmkill-*.so files |
| 119 | entries, err := os.ReadDir(binDir) |
| 120 | if err != nil { |
| 121 | return |
| 122 | } |
| 123 | |
| 124 | for _, entry := range entries { |
| 125 | name := entry.Name() |
| 126 | if filepath.Ext(name) == ".so" && len(name) > 7 && name[:7] == "jvmkill" { |
| 127 | j.agentPath = filepath.Join(binDir, name) |
| 128 | j.ctx.Log.Debug("Detected installed JVMKill agent: %s", j.agentPath) |
| 129 | return |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | // Finalize adds JVMKill to JAVA_OPTS |
| 135 | func (j *JVMKillAgent) Finalize() error { |