Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing-busy waiting loop #server session #3126

Closed

Conversation

ghost
Copy link

@ghost ghost commented Dec 7, 2024

What problem does this PR solve?

This PR addresses the issue of busy-waiting in the session expiration task of the Server Session Pattern. Previously, the session expiration thread continuously checked for expired sessions without any pauses, which led to unnecessary CPU consumption.

Key improvements:
Replaced the busy-waiting loop with a Thread.sleep() mechanism, ensuring the thread pauses and consumes no CPU resources between checks.
Added graceful handling of thread interruptions for proper thread lifecycle management.

This change significantly reduces the overhead caused by constantly checking for session expiration, making the session management more efficient and resource-friendly.

Copy link

sonarqubecloud bot commented Dec 7, 2024

@ghost ghost changed the title Update README.md fixing-busy waiting loop #server session Dec 7, 2024
@iluwatar
Copy link
Owner

Changing the README.md file doesn't fix the code because the README.md file is a documentation file, not the code itself.

@iluwatar iluwatar closed this Dec 16, 2024
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.

1 participant