This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9f9ad60bb15563e78c39368f4a880b1341498bfb
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Jan 21 10:37:50 2021 +0100

    CAMEL-16056: Added camel-jfr for java flight recorder integration
---
 .../camel/startup/jfr/FlightRecorderStartupStepRecorder.java   |  6 +++---
 .../resources/META-INF/camel-main-configuration-metadata.json  |  2 +-
 core/camel-main/src/main/docs/main.adoc                        |  2 +-
 .../org/apache/camel/main/DefaultConfigurationProperties.java  | 10 ++++++----
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/components/camel-jfr/src/main/java/org/apache/camel/startup/jfr/FlightRecorderStartupStepRecorder.java
 
b/components/camel-jfr/src/main/java/org/apache/camel/startup/jfr/FlightRecorderStartupStepRecorder.java
index 3a1370c..40f0f08 100644
--- 
a/components/camel-jfr/src/main/java/org/apache/camel/startup/jfr/FlightRecorderStartupStepRecorder.java
+++ 
b/components/camel-jfr/src/main/java/org/apache/camel/startup/jfr/FlightRecorderStartupStepRecorder.java
@@ -53,7 +53,7 @@ public class FlightRecorderStartupStepRecorder extends 
DefaultStartupStepRecorde
             Configuration config = 
Configuration.getConfiguration(getRecordingProfile());
             rec = new Recording(config);
             rec.setName("Camel Recording");
-            if (getStartupRecorderDuration() < 0) {
+            if (getStartupRecorderDuration() == 0) {
                 Path dir = getRecordingDir() != null ? 
Paths.get(getRecordingDir()) : Paths.get(System.getenv().get("HOME"));
                 Path file = Files.createTempFile(dir, "camel-recording", 
".jfr");
                 rec.setDumpOnExit(true);
@@ -88,7 +88,7 @@ public class FlightRecorderStartupStepRecorder extends 
DefaultStartupStepRecorde
     public void doStop() throws Exception {
         super.doStop();
 
-        if (rec != null && getStartupRecorderDuration() >= 0) {
+        if (rec != null && getStartupRecorderDuration() != 0) {
             dumpRecording();
         }
     }
@@ -97,7 +97,7 @@ public class FlightRecorderStartupStepRecorder extends 
DefaultStartupStepRecorde
         if (!"false".equals(getRecordingDir())) {
             try {
                 Path dir = getRecordingDir() != null ? 
Paths.get(getRecordingDir()) : Paths.get(System.getenv().get("HOME"));
-                Path file = Files.createTempFile(dir, "camel-recording", 
".jfr");
+                Path file = Files.createTempFile(dir, "camel-recording-", 
".jfr");
                 if (rec.getState().equals(RecordingState.RUNNING)) {
                     // need to do GC to capture details to the recording 
(specially when its short running)
                     LOG.info("Stopping Java flight recorder");
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 904371c..7e90a22 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -73,7 +73,7 @@
     { "name": "camel.main.shutdownTimeout", "description": "Timeout in seconds 
to graceful shutdown Camel.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 45 },
     { "name": "camel.main.startupRecorder", "description": "To use startup 
recorder for capturing execution time during starting Camel. The recorder can 
be one of: false, logging, java-flight-recorder The default is false.", 
"sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.main.startupRecorderDir", "description": "Directory to 
store the recording. By default the user home directory will be used. Use false 
to turn off saving recording to disk.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
-    { "name": "camel.main.startupRecorderDuration", "description": "How long 
time to run the startup recorder. Use 0 (default) to stop the recorder after 
Camel has been started. Use -1 to keep the recorder running until the JVM is 
being stopped. A positive value is to run the recorder for N seconds. When the 
recorder is stopped then the recording is auto saved to disk (note: save to 
disk can be disabled by setting startupRecorderDir to false)", "sourceType": 
"org.apache.camel.main.Defaul [...]
+    { "name": "camel.main.startupRecorderDuration", "description": "How long 
time to run the startup recorder. Use 0 (default) to keep the recorder running 
until the JVM is exited. Use -1 to stop the recorder right after Camel has been 
started (to only focus on potential Camel startup performance bottlenecks) Use 
a positive value to keep recording for N seconds. When the recorder is stopped 
then the recording is auto saved to disk (note: save to disk can be disabled by 
setting startupRec [...]
     { "name": "camel.main.startupRecorderMaxDepth", "description": "To filter 
our sub steps at a maximum depth. Use -1 for no maximum. Use 0 for no sub 
steps. Use 1 for max 1 sub step, and so forth. The default is -1.", 
"sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": 
"integer", "javaType": "int", "defaultValue": -1 },
     { "name": "camel.main.startupRecorderProfile", "description": "To use a 
specific Java Flight Recorder profile configuration, such as default or 
profile. The default is default.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "default" },
     { "name": "camel.main.startupRecorderRecording", "description": "To enable 
Java Flight Recorder to start a recording and automatic dump the recording to 
disk after startup is complete. This requires that camel-jfr is on the 
classpath. The default is true.", "sourceType": 
"org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": true },
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index 41482be..6b9d236 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -85,7 +85,7 @@ The following table lists all the options:
 | *camel.main.shutdownTimeout* | Timeout in seconds to graceful shutdown 
Camel. | 45 | int
 | *camel.main.startupRecorder* | To use startup recorder for capturing 
execution time during starting Camel. The recorder can be one of: false, 
logging, java-flight-recorder The default is false. |  | String
 | *camel.main.startupRecorderDir* | Directory to store the recording. By 
default the user home directory will be used. Use false to turn off saving 
recording to disk. |  | String
-| *camel.main.startupRecorder{zwsp}Duration* | How long time to run the 
startup recorder. Use 0 (default) to stop the recorder after Camel has been 
started. Use -1 to keep the recorder running until the JVM is being stopped. A 
positive value is to run the recorder for N seconds. When the recorder is 
stopped then the recording is auto saved to disk (note: save to disk can be 
disabled by setting startupRecorderDir to false) |  | long
+| *camel.main.startupRecorder{zwsp}Duration* | How long time to run the 
startup recorder. Use 0 (default) to keep the recorder running until the JVM is 
exited. Use -1 to stop the recorder right after Camel has been started (to only 
focus on potential Camel startup performance bottlenecks) Use a positive value 
to keep recording for N seconds. When the recorder is stopped then the 
recording is auto saved to disk (note: save to disk can be disabled by setting 
startupRecorderDir to false) |  | long
 | *camel.main.startupRecorderMax{zwsp}Depth* | To filter our sub steps at a 
maximum depth. Use -1 for no maximum. Use 0 for no sub steps. Use 1 for max 1 
sub step, and so forth. The default is -1. | -1 | int
 | *camel.main.startupRecorder{zwsp}Profile* | To use a specific Java Flight 
Recorder profile configuration, such as default or profile. The default is 
default. | default | String
 | *camel.main.startupRecorder{zwsp}Recording* | To enable Java Flight Recorder 
to start a recording and automatic dump the recording to disk after startup is 
complete. This requires that camel-jfr is on the classpath. The default is 
true. | true | boolean
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
index 132ec64..1ec2f09 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
@@ -1167,8 +1167,9 @@ public abstract class DefaultConfigurationProperties<T> {
     /**
      * How long time to run the startup recorder.
      *
-     * Use 0 (default) to stop the recorder after Camel has been started. Use 
-1 to keep the recorder running until the
-     * JVM is being stopped. A positive value is to run the recorder for N 
seconds.
+     * Use 0 (default) to keep the recorder running until the JVM is exited. 
Use -1 to stop the recorder right after
+     * Camel has been started (to only focus on potential Camel startup 
performance bottlenecks) Use a positive value to
+     * keep recording for N seconds.
      *
      * When the recorder is stopped then the recording is auto saved to disk 
(note: save to disk can be disabled by
      * setting startupRecorderDir to false)
@@ -1989,8 +1990,9 @@ public abstract class DefaultConfigurationProperties<T> {
     /**
      * How long time to run the startup recorder.
      *
-     * Use 0 (default) to stop the recorder after Camel has been started. Use 
-1 to keep the recorder running until the
-     * JVM is being stopped. A positive value is to run the recorder for N 
seconds.
+     * Use 0 (default) to keep the recorder running until the JVM is exited. 
Use -1 to stop the recorder right after
+     * Camel has been started (to only focus on potential Camel startup 
performance bottlenecks) Use a positive value to
+     * keep recording for N seconds.
      *
      * When the recorder is stopped then the recording is auto saved to disk 
(note: save to disk can be disabled by
      * setting startupRecorderDir to false)

Reply via email to