This repository was archived by the owner on Feb 10, 2021. It is now read-only.
Cat 3240 java sdk fix connection concurrency#25
Merged
lfavaro-daitan merged 5 commits intomasterfrom Jun 10, 2015
Merged
Conversation
Contributor
There was a problem hiding this comment.
Convert the string values to Integer in this step and throw exception specifying what is wrong
lfavaro-daitan
pushed a commit
that referenced
this pull request
Jun 10, 2015
…tion_concurrency Cat 3240 java sdk fix connection concurrency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 fix implements a PoolingHttpClientConnectionManager into BandwidthClient, so client could support singleton pattern so allowing concurrency.
In order to implement PoolingHttpClientConnectionManager, these recommendations were followed:
https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
Other fix was to use Joda time, since SimpleDateFormat caused concurrency issues as well.
Most of the libraries were updated to its latest available release.
I have used this algorithm to validate the changes:
public static void main(String[] args) throws Exception {
BandwidthClient client = BandwidthClient.getInstance();
client.setCredentials("",
"",
"");
client.setEndpointandVersion("", "v1");
ExecutorService executor = Executors.newCachedThreadPool();
for (int i = 0; i < 100; i++) {
executor.execute(new Runnable() {