Croway commented on code in PR #27279:
URL: https://github.com/apache/camel/pull/27279#discussion_r4165878340
##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/WebSocketCliConnectorTransport.java:
##########
@@ -94,12 +94,15 @@ public class WebSocketCliConnectorTransport extends
ServiceSupport implements Cl
private CliWebSocketClient client;
private ThreadPoolExecutor actions;
private ScheduledExecutorService scheduler;
+ // collects snapshots: the status of a large integration can take seconds,
which must not hold up the scheduler
+ // (heartbeats, sends); snapshots are handed to the scheduler to be sent
+ private ScheduledExecutorService collector;
// fields below are only used from the scheduler thread, except the
volatile ones
Review Comment:
Done in 3a5caeffdaa2: the class javadoc now describes the three threads
(actions, collector, scheduler), and the field comments say which fields the
collector owns (`snapshotFuture`, `debugFuture`, `ticks`, and `lastTraceUid` /
`lastReceiveUid` / `lastSent` on `Connection`).
_Claude Code on behalf of Croway_
##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/WebSocketCliConnectorTransport.java:
##########
@@ -491,7 +521,8 @@ private void sendSnapshot(Connection c, String kind,
JsonObject data) {
JsonObject frame = envelope("snapshot");
frame.put("kind", kind);
frame.put("data", data);
- send(c, frame);
+ // only the scheduler sends, one frame at a time
+ execute(() -> send(c, frame));
Review Comment:
Done in 3a5caeffdaa2 with the marker approach: `snapshotRound` queues a task
on the scheduler behind the frames of its round, and only that task schedules
the next round (back on the collector). So a round starts only after the
previous round's frames were sent. A round counter, bumped by
`scheduleSnapshots`, keeps `updateDelay` from starting a second chain.
_Claude Code on behalf of Croway_
--
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]