Skip to content

Commit 3f4e022

Browse files
committed
Fix jma properties
1 parent 9715ea1 commit 3f4e022

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/java/frameworks/java_memory_assistant.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (j *JavaMemoryAssistantFramework) Finalize() error {
9292
agentConfig := j.buildAgentConfig()
9393

9494
// Construct javaagent argument
95-
javaagentArg := fmt.Sprintf("-javaagent:%s=%s", runtimeAgentPath, agentConfig)
95+
javaagentArg := fmt.Sprintf("-javaagent:%s %s", runtimeAgentPath, agentConfig)
9696

9797
// For Java 9+, add --add-opens to allow access to internal management APIs
9898
// This is required for Java Memory Assistant to access com.sun.management.HotSpotDiagnosticMXBean
@@ -129,32 +129,28 @@ func (j *JavaMemoryAssistantFramework) buildAgentConfig() string {
129129
// Heap dump folder (default: $PWD or volume service mount point)
130130
heapDumpFolder := j.getHeapDumpFolder()
131131
if heapDumpFolder != "" {
132-
configParts = append(configParts, fmt.Sprintf("heap-dump-folder=%s", heapDumpFolder))
132+
configParts = append(configParts, fmt.Sprintf("-Djma.heap-dump-folder=%s", heapDumpFolder))
133133
}
134134

135135
// Check interval (default: 5s)
136136
checkInterval := config.Agent.CheckInterval
137-
configParts = append(configParts, fmt.Sprintf("check-interval=%s", checkInterval))
137+
configParts = append(configParts, fmt.Sprintf("-Djma.check-interval=%s", checkInterval))
138138

139139
// Max frequency (default: 1/1m)
140140
maxFrequency := config.Agent.MaxFrequency
141-
configParts = append(configParts, fmt.Sprintf("max-frequency=%s", maxFrequency))
141+
configParts = append(configParts, fmt.Sprintf("-Djma.max-frequency=%s", maxFrequency))
142142

143143
// Log level (use buildpack log level if not specified)
144144
logLevel := config.Agent.LogLevel
145-
configParts = append(configParts, fmt.Sprintf("log-level=%s", logLevel))
145+
configParts = append(configParts, fmt.Sprintf("-Djma.log-level=%s", logLevel))
146146

147147
// Thresholds (default: old_gen >600MB)
148148
thresholds := config.getThresholds()
149149
for memArea, threshold := range thresholds {
150-
configParts = append(configParts, fmt.Sprintf("threshold.%s=%s", memArea, threshold))
150+
configParts = append(configParts, fmt.Sprintf("-Djma.threshold.%s=%s", memArea, threshold))
151151
}
152152

153-
// Max dump count (default: 1)
154-
maxDumpCount := config.CleanUp.MaxDumpCount
155-
configParts = append(configParts, fmt.Sprintf("max-dump-count=%v", maxDumpCount))
156-
157-
return strings.Join(configParts, ",")
153+
return strings.Join(configParts, " ")
158154
}
159155

160156
// getHeapDumpFolder determines the heap dump folder location

0 commit comments

Comments
 (0)