Skip to content

feat: enhanced performance when async (throttle)#399

Merged
petruki merged 1 commit into
master-2from
staging
Jun 30, 2026
Merged

feat: enhanced performance when async (throttle)#399
petruki merged 1 commit into
master-2from
staging

Conversation

@petruki

@petruki petruki commented Jun 30, 2026

Copy link
Copy Markdown
Member

This pull request introduces several improvements focused on code clarity, performance, and thread management in the Switcher Client SDK. The most significant changes include switching to a single-threaded executor for asynchronous tasks, optimizing the logic for bypass and async execution, and updating the project version for ongoing development.

Threading and Executor Management:

  • Changed the AsyncSwitcher class to use a newSingleThreadExecutor instead of a newCachedThreadPool, ensuring that async tasks are executed sequentially and reducing potential concurrency issues.

Performance and Code Clarity:

  • Improved the execute method in AsyncSwitcher by caching System.currentTimeMillis() and logger.isDebugEnabled() to variables, reducing redundant calls and clarifying debug logic.
  • Updated the bypass logic in SwitcherRequest.submit() to check if the bypass map is non-empty before accessing it, and replaced Objects utility methods with direct null checks for better readability and slight performance gain.

Dependency and Version Management:

  • Updated the project version in pom.xml from 2.6.0 to 2.6.1-SNAPSHOT to indicate ongoing development.

Imports Cleanup:

  • Replaced unnecessary Objects import with Map in SwitcherRequest.java to match the updated code.

@petruki petruki added this to the v2.6.1 milestone Jun 30, 2026
@petruki petruki self-assigned this Jun 30, 2026
@petruki petruki added the enhancement New feature or request label Jun 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@petruki petruki merged commit 30aed9f into master-2 Jun 30, 2026
21 of 23 checks passed
@petruki petruki deleted the staging branch June 30, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant