gnodet-bot commented on code in PR #27499:
URL: https://github.com/apache/camel/pull/27499#discussion_r4207027269
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DataRefreshService.java:
##########
@@ -428,6 +431,27 @@ static void mergePhantoms(List<IntegrationInfo> infos,
List<IntegrationInfo> pha
}
}
+ /**
+ * The app F10 launched for the project: the launched process or a
descendant of it. A folder of route files runs
+ * from the working directory of the monitor, or from a copy in
.camel-jbang-run when a runtime is chosen, so its
+ * app does not report the project folder as its directory (CAMEL-25417).
+ */
+ static IntegrationInfo launchedApp(IntegrationInfo phantom,
List<IntegrationInfo> infos) {
+ ProcessHandle launched = phantom.launchedProcess;
+ if (launched == null) {
+ return null;
+ }
Review Comment:
💡 **Style:** `java.util.Set` and `java.util.HashSet` are already imported at
the top of this file (lines 26 and 30). Use the simple names:
```suggestion
Set<String> pids = new HashSet<>();
```
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/IntegrationInfo.java:
##########
@@ -39,6 +39,8 @@ class IntegrationInfo {
String openedAs;
// an opened project: when it was asked to run, until its app shows up (or
the launch fails)
long startingSince;
+ // the process F10 launched for an opened project: its app is that process
or a descendant of it (CAMEL-25417)
+ ProcessHandle launchedProcess;
Review Comment:
⚠️ **Concurrency:** `launchedProcess` is written from the UI thread (in
`ActionsPopup.launchFromPhantom`) and read from the background refresh thread
(in `DataRefreshService.launchedApp`). Without `volatile`, the read may see a
stale null even after the field has been set.
This follows the same non-volatile pattern as other `IntegrationInfo`
fields, but those aren't accessed across a UI/background thread boundary — this
one is.
```suggestion
volatile ProcessHandle launchedProcess;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]