Skip to content

GH-249 Use eternalcodecommons virtual threads.#249

Open
vLuckyyy wants to merge 2 commits intomasterfrom
virtual-thread
Open

GH-249 Use eternalcodecommons virtual threads.#249
vLuckyyy wants to merge 2 commits intomasterfrom
virtual-thread

Conversation

@vLuckyyy
Copy link
Member

No description provided.

@vLuckyyy vLuckyyy marked this pull request as ready for review February 23, 2026 23:23
@vLuckyyy vLuckyyy changed the title Use eternalcodecommons virtual threads. GH-249 Use eternalcodecommons virtual threads. Feb 23, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vLuckyyy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the application's task scheduling infrastructure by migrating from a custom scheduler implementation to the LoomScheduler provided by the eternalcode-commons-loom library. This change leverages Java's Project Loom (virtual threads) for more efficient and scalable concurrency management, streamlining asynchronous operations and scheduled tasks throughout the codebase.

Highlights

  • Dependency Update: The build.gradle.kts file has been updated to use version 1.3.4 of eternalcode-commons-shared and now includes a new dependency, eternalcode-commons-loom:1.3.4.
  • Scheduler Migration: The custom Scheduler interface and its VirtualThreadSchedulerImpl implementation have been removed, replaced by the LoomScheduler from the eternalcode-commons-loom library.
  • Task Scheduling API Update: All instances of task scheduling across the application (e.g., in DiscordApp, GitHubReviewReminderService, GitHubReviewTask, GitHubReviewMentionRepositoryImpl, and TicketConfigurer) have been refactored to use the new LoomScheduler methods like runAsyncLater, runAsyncTimer, supplyAsync, and delay.
  • Scheduler Shutdown Enhancement: The shutdown() method for the scheduler now accepts a Duration parameter, allowing for a graceful shutdown with a specified timeout.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • build.gradle.kts
    • Updated eternalcode-commons-shared dependency to version 1.3.4
    • Added eternalcode-commons-loom dependency version 1.3.4
  • src/main/java/com/eternalcode/discordapp/DiscordApp.java
    • Replaced imports for custom scheduler with LoomScheduler imports
    • Updated the scheduler field type from Scheduler to LoomScheduler
    • Instantiated LoomSchedulerImpl with MainThreadDispatcher.synchronous()
    • Migrated scheduler.schedule calls to scheduler.runAsyncLater
    • Migrated scheduler.scheduleRepeating calls to scheduler.runAsyncTimer
    • Updated scheduler.shutdown() call to scheduler.shutdown(Duration.ofSeconds(30))
  • src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewReminderService.java
    • Replaced Scheduler import with LoomScheduler import
    • Updated scheduler field type from Scheduler to LoomScheduler
    • Migrated scheduler.scheduleRepeating call to scheduler.runAsyncTimer
    • Replaced custom delay method implementation with this.scheduler.delay(delay).toCompletableFuture()
  • src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewTask.java
    • Replaced Scheduler import with LoomScheduler import
    • Updated scheduler field type from Scheduler to LoomScheduler
    • Migrated scheduler.scheduleRepeating call to scheduler.runAsyncTimer
  • src/main/java/com/eternalcode/discordapp/feature/review/database/GitHubReviewMentionRepositoryImpl.java
    • Replaced Scheduler import with LoomScheduler import
    • Updated scheduler field type from Scheduler to LoomScheduler
    • Migrated scheduler.scheduleRepeating call to scheduler.runAsyncTimer
    • Replaced CompletableFuture.runAsync and CompletableFuture.supplyAsync calls with this.scheduler.supplyAsync and toCompletableFuture() conversions
  • src/main/java/com/eternalcode/discordapp/feature/ticket/TicketConfigurer.java
    • Replaced Scheduler import with LoomScheduler import
    • Updated scheduler field type from Scheduler to LoomScheduler
    • Migrated scheduler.scheduleRepeating call to scheduler.runAsyncTimer
  • src/main/java/com/eternalcode/discordapp/scheduler/Scheduler.java
    • Removed the Scheduler interface
  • src/main/java/com/eternalcode/discordapp/scheduler/VirtualThreadSchedulerImpl.java
    • Removed the VirtualThreadSchedulerImpl class
Activity
  • No human activity (comments, reviews) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the project to use eternalcode-commons-loom for virtual threads, replacing the custom Scheduler and VirtualThreadSchedulerImpl implementations. This change streamlines the scheduling logic by leveraging a dedicated library, improving consistency and potentially reducing maintenance overhead. The changes involve updating dependencies, replacing scheduler imports and types, and adapting task scheduling calls to the new LoomScheduler API. Overall, the changes are well-implemented and align with the goal of utilizing virtual threads more effectively.

I am having trouble creating individual review comments. Click here to see my feedback.

build.gradle.kts (69-70)

medium

The eternalcode-commons-shared dependency has been updated to 1.3.4, and eternalcode-commons-loom version 1.3.4 has been added. This is a good update to leverage the new virtual thread capabilities.

src/main/java/com/eternalcode/discordapp/DiscordApp.java (51-53)

medium

The custom Scheduler and VirtualThreadSchedulerImpl imports have been replaced with LoomScheduler, LoomSchedulerImpl, and MainThreadDispatcher from com.eternalcode.commons.scheduler.loom. This is a necessary change to integrate the new virtual thread library.

src/main/java/com/eternalcode/discordapp/DiscordApp.java (76)

medium

The type of the scheduler field has been updated from Scheduler to LoomScheduler, reflecting the change to the new scheduling library.

src/main/java/com/eternalcode/discordapp/DiscordApp.java (121)

medium

The instantiation of the scheduler now uses LoomSchedulerImpl with MainThreadDispatcher.synchronous(), which is appropriate for the new virtual thread implementation.

src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewReminderService.java (6)

medium

The import for Scheduler has been replaced with LoomScheduler from com.eternalcode.commons.scheduler.loom.

src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewReminderService.java (25)

medium

The type of the scheduler field has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewReminderService.java (34)

medium

The constructor parameter for scheduler has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewTask.java (4)

medium

The import for Scheduler has been replaced with LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewTask.java (23)

medium

The type of the scheduler field has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/GitHubReviewTask.java (26)

medium

The constructor parameter for scheduler has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/database/GitHubReviewMentionRepositoryImpl.java (10)

medium

The import for Scheduler has been replaced with LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/database/GitHubReviewMentionRepositoryImpl.java (31)

medium

The type of the scheduler field has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/database/GitHubReviewMentionRepositoryImpl.java (33)

medium

The constructor parameter for scheduler has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/review/database/GitHubReviewMentionRepositoryImpl.java (44)

medium

The create method parameter for scheduler has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/ticket/TicketConfigurer.java (6)

medium

The import for Scheduler has been replaced with LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/ticket/TicketConfigurer.java (27)

medium

The type of the scheduler field has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/feature/ticket/TicketConfigurer.java (35)

medium

The constructor parameter for scheduler has been updated to LoomScheduler.

src/main/java/com/eternalcode/discordapp/scheduler/Scheduler.java (1-16)

medium

The Scheduler interface has been removed as its functionality is now provided by eternalcode-commons-loom.

src/main/java/com/eternalcode/discordapp/scheduler/VirtualThreadSchedulerImpl.java (1-185)

medium

The VirtualThreadSchedulerImpl class has been removed, as its functionality is now provided by eternalcode-commons-loom.

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.

2 participants