You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Busy-waiting, or spinning, is a technique where a process repeatedly checks to see if a condition is true, such as whether keyboard input or a lock is available. While it might seem like a good idea, it has several significant drawbacks:
CPU Usage: Busy-waiting can consume a lot of CPU time. While a process is busy-waiting, it keeps the CPU busy. This can prevent other processes from running and can lead to high CPU usage, especially if the condition being checked doesn't become true for a long time.
Performance: Busy-waiting can lead to performance issues. If a process is busy-waiting, it's not doing any useful work. This can slow down the overall performance of your application.
Responsiveness: Busy-waiting can make your application less responsive. If a process is busy-waiting, it might not be able to respond to user input or other events in a timely manner.
Power Consumption: Busy-waiting can lead to increased power consumption, especially on battery-powered devices. This is because the CPU is kept busy and is not allowed to enter a low-power state.
Instead of busy-waiting, it's generally better to use some form of event-driven programming or blocking. This allows your process to sleep until the condition it's waiting for becomes true, which can save CPU time, improve performance, and make your application more responsive.
Busy-waiting loops are at least in these locations:
Server Session / App.java
Twin / BallThread.java
Log Aggregation / LogAggregator.java
Commander / Retry.java
Retry / Retry.java
Retry / RetryExponentialBackoff.java
Queue-Based Load Leveling / ServiceExecutor.java
Acceptance Criteria
Busy-waiting loops refactored
README.md of the affected patterns revised as needed
This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.
I’m a beginner Java developer and would like to work on this issue.
I plan to start by identifying one of the busy-waiting loops mentioned
and refactor it using a proper waiting mechanism.
If this approach sounds good, please let me know.
Any guidance on which file would be best to start with is appreciated.
Hi @iluwatar!
I am a student developer and I'm learning Java[Beginner Level]
I would like to contribute by fixing a busy-waiting loop. Could you please guide me on which module I should look into, or can I pick any available one from the list above
Activity
Fix busy-waiting loops iluwatar#2977
TATIKONDAVENKATESH commentedon Jul 1, 2024
i am new here, i want to contribute to this project
Mehdi-17 commentedon Jul 2, 2024
Hello, i'm available to work on it
Mehdi-17 commentedon Jul 12, 2024
Thanks, I've just started working on this.
stale commentedon Sep 11, 2024
This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.
shalini-bhandari commentedon Oct 1, 2024
Hello, this is my first time in open source.
Is this issue still open? and how to go about it?
59 remaining items
SakshiHanwat commentedon Oct 31, 2025
“Hi! I’d love to work on this issue for Hacktoberfest. Could you please assign it to me?”
tulsi-kumari commentedon Nov 23, 2025
Hi Would like to solve this one, can you assign it to me?
Varun5157 commentedon Dec 22, 2025
Hello maintainers,
I’m a beginner Java developer and would like to work on this issue.
I plan to start by identifying one of the busy-waiting loops mentioned
and refactor it using a proper waiting mechanism.
If this approach sounds good, please let me know.
Any guidance on which file would be best to start with is appreciated.
Thanks!
NavyaNuthalapati commentedon Jan 10, 2026
Hi @iluwatar!
I am a student developer and I'm learning Java[Beginner Level]
I would like to contribute by fixing a busy-waiting loop. Could you please guide me on which module I should look into, or can I pick any available one from the list above
nasreenkhannam commentedon Jan 20, 2026
Hello maintainers,
I’m a beginner Java developer and I’m exploring this project.
I’d like to understand the busy-waiting patterns better by looking at
one small example.
Could you please suggest a file or module that would be suitable
for a beginner to start with?
Thank you!
Kaaldut8 commentedon Mar 6, 2026
Hi @iluwatar , I would like to work on this issue.
I have started refactoring the busy-waiting loop in all the given locations.
talon1126 commentedon Mar 30, 2026
Hello, i'm available to work on it
Yashgarg0101 commentedon May 2, 2026
Hi, I would like to work on this issue. I am a beginner and would appreciate guidance.
iluwatar commentedon May 3, 2026
This is a hard issue to get right. I wouldn't recommend this for a beginner @Yashgarg0101
eric-muganga commentedon May 8, 2026
Hello, I’m a beginner Java developer and would like to work on this issue.
MohamedMBG commentedon Jul 23, 2026
@iluwatar i am working on this issue if it's free
MohamedMBG commentedon Jul 23, 2026
#3548 here is the PR
fix: replace busy-wait in BallThread with wait/notify (iluwatar#2977)