feat: improved async performance with thread-safe type #381
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



This pull request refactors how history execution is managed in the
SwitcherBuilderand its concrete implementationSwitcherRequest, improves thread safety, and simplifies null checks across the codebase. The main theme is to make the history execution logic more robust and concurrent, while also standardizing null checks usingObjects.nonNullandObjects.isNull.History Execution Refactor
historyExecutionmap from the abstractSwitcherBuilderto the concreteSwitcherRequestclass, and changed its implementation from a regularHashMapto a thread-safeConcurrentHashMapfor better concurrency support. ([[1]](https://github.com/switcherapi/switcher-client-java/pull/381/files#diff-ac0544cec82f9e6e850d4929bf6edf6ba3397237b1bba0012f503cba484971e7L19-L20),[[2]](https://github.com/switcherapi/switcher-client-java/pull/381/files#diff-50b643c046fcf01d65f95fbeb497f0da0daaf755828ef185e1a3bd8381b2b710R27-R28),[[3]](https://github.com/switcherapi/switcher-client-java/pull/381/files#diff-50b643c046fcf01d65f95fbeb497f0da0daaf755828ef185e1a3bd8381b2b710R48))flushmethod inSwitcherBuilderto be abstract, withSwitcherRequestnow implementing it to clear bothentryandhistoryExecution. ([[1]](https://github.com/switcherapi/switcher-client-java/pull/381/files#diff-ac0544cec82f9e6e850d4929bf6edf6ba3397237b1bba0012f503cba484971e7L45-R42),[[2]](https://github.com/switcherapi/switcher-client-java/pull/381/files#diff-50b643c046fcf01d65f95fbeb497f0da0daaf755828ef185e1a3bd8381b2b710R72-R78))Thread Safety and Synchronization
synchronizedkeyword from theexecutemethod inAsyncSwitcher, potentially improving performance and relying on the thread safety of the underlying data structures. ([src/main/java/com/switcherapi/client/model/AsyncSwitcher.javaL49-R49](https://github.com/switcherapi/switcher-client-java/pull/381/files#diff-c4e53fc6b375fc5ce77e080aa254d0321fef50ebdb25a7ccf460bbf9a2c4041dL49-R49))[Before] Operations /s in 5s
[After] Operations /s in 5s