MCPcopy Index your code
hub / github.com/cloudfoundry/java-buildpack / Finalize

Method Finalize

src/java/frameworks/jmx.go:51–76  ·  view source on GitHub ↗

Finalize adds JMX options to JAVA_OPTS via profile.d script

()

Source from the content-addressed store, hash-verified

49
50// Finalize adds JMX options to JAVA_OPTS via profile.d script
51func (j *JmxFramework) Finalize() error {
52 config, err := j.loadConfig()
53 if err != nil {
54 j.context.Log.Warning("Failed to load debug config: %s", err.Error())
55 return nil // Don't fail the build
56 }
57
58 port := config.getPort()
59
60 // Build JMX system properties
61 jmxOpts := fmt.Sprintf(
62 "-Djava.rmi.server.hostname=127.0.0.1 "+
63 "-Dcom.sun.management.jmxremote.authenticate=false "+
64 "-Dcom.sun.management.jmxremote.ssl=false "+
65 "-Dcom.sun.management.jmxremote.port=%d "+
66 "-Dcom.sun.management.jmxremote.rmi.port=%d",
67 port, port,
68 )
69
70 // Write JAVA_OPTS to .opts file with priority 29 (Ruby buildpack line 63)
71 if err := writeJavaOptsFile(j.context, 29, "jmx", jmxOpts); err != nil {
72 return fmt.Errorf("failed to write java_opts file: %w", err)
73 }
74
75 return nil
76}
77
78func (j *JmxFramework) loadConfig() (*jmxConfig, error) {
79 // initialize default values

Callers

nothing calls this directly

Calls 3

loadConfigMethod · 0.95
writeJavaOptsFileFunction · 0.85
getPortMethod · 0.45

Tested by

no test coverage detected