Skip to content

refactor(RemoteServicesInspector): simplify getServicesInfo using List and plain loop#1025

Open
freddidierRTE wants to merge 1 commit into
mainfrom
about
Open

refactor(RemoteServicesInspector): simplify getServicesInfo using List and plain loop#1025
freddidierRTE wants to merge 1 commit into
mainfrom
about

Conversation

@freddidierRTE

Copy link
Copy Markdown
Contributor

PR Summary

  • Replace the raw CompletableFuture array with a List to avoid the unchecked cast workaround and the need for the @SuppressWarnings annotation.

  • The parallel stream was replaced by a sequential stream since parallelism is already handled by the async CompletableFuture calls themselves; using parallelStream() on the mapping step brought no real benefit here.

  • The AtomicBoolean used to track partial results across a lambda is replaced by a plain boolean, improving readability now that the result collection is done in a standard for-loop.

  • The PartialResultException is now thrown with the result HashMap directly, removing a redundant defensive copy (new HashMap<>(result)).

  • Also fix a minor logging issue: replace string concatenation in the LOGGER.debug call with a parameterized message pattern {} to align with SLF4J best practices and avoid unnecessary string construction when debug logging is disabled.efacto getServiceInfo

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@freddidierRTE, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 802c73f0-2747-40f5-88f8-5dd2f92ae4ae

📥 Commits

Reviewing files that changed from the base of the PR and between 73dc410 and 1038e85.

📒 Files selected for processing (1)
  • src/main/java/org/gridsuite/study/server/service/RemoteServicesInspector.java
📝 Walkthrough

Walkthrough

RemoteServicesInspector now aggregates asynchronous service responses through a list of futures and a sequential loop, tracks partial results locally, throws with the aggregated map when needed, and uses parameterized debug logging.

Changes

Remote Service Inspection

Layer / File(s) Summary
Partial-result aggregation and logging
src/main/java/org/gridsuite/study/server/service/RemoteServicesInspector.java
getServicesInfo replaces the atomic stream-based aggregation with list-based futures and sequential result processing, while getServiceInfo uses SLF4J placeholder formatting for debug output.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main refactor in RemoteServicesInspector and mentions the key getServicesInfo change.
Description check ✅ Passed The description matches the refactor and logging updates described in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors RemoteServicesInspector#getServicesInfo to simplify the async aggregation of /actuator/info responses across remote services, reducing generics/stream complexity while keeping the existing “partial results” behavior (NullNode-based detection) and improving debug logging.

Changes:

  • Replace the raw CompletableFuture[] + unchecked cast with a List<CompletableFuture<...>> and a plain loop to collect results.
  • Remove parallelStream()/AtomicBoolean in favor of sequential stream + simple boolean flag tracking.
  • Parameterize the SLF4J LOGGER.debug message to avoid eager string concatenation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jonenst

jonenst commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

code OK
test OK

…t and plain loop

- Replace the raw CompletableFuture array with a List<CompletableFuture> to avoid
the unchecked cast workaround and the need for the @SuppressWarnings annotation.

- The parallel stream was replaced by a sequential stream since parallelism is
already handled by the async CompletableFuture calls themselves; using
parallelStream() on the mapping step brought no real benefit here.

- The AtomicBoolean used to track partial results across a lambda is replaced by
a plain boolean, improving readability now that the result collection is done
in a standard for-loop.

- The PartialResultException is now thrown with the result HashMap directly,
removing a redundant defensive copy (new HashMap<>(result)).

- Also fix a minor logging issue: replace string concatenation in the LOGGER.debug
call with a parameterized message pattern {} to align with SLF4J best practices
and avoid unnecessary string construction when debug logging is disabled.efacto getServiceInfo

Signed-off-by: freddidierRTE <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants