Skip to content

ClientBuilder.build is now asynchronous.#141

Merged
NiteshKant merged 3 commits intomasterfrom
stevegury/clientbuilder_async_build
Jul 12, 2016
Merged

ClientBuilder.build is now asynchronous.#141
NiteshKant merged 3 commits intomasterfrom
stevegury/clientbuilder_async_build

Conversation

@stevegury
Copy link
Copy Markdown
Member

_Problem_
The ClientBuilder build API return a ReactiveSocket.
This ReactiveSocket is returned while connections are still in establishing
mode, then it will fail until the connections established.
The current solution is to call Unsafe.awaitAvailability which is cluncky.

_Solution_
Create a more robust API that return a Publisher<ReactiveSocket>, it is now
obvious that the API is asynchronous.

_Modification_
I found a bug in sourceToFactory, where I was calling subscriber.onSubscribe
before initializing the current Map.

***Problem***
The ClientBuilder `build` API return a ReactiveSocket.
This ReactiveSocket is returned while connections are still in establishing
mode, then it will fail until the connections established.
The current solution is to call `Unsafe.awaitAvailability` which is cluncky.

***Solution***
Create a more robust API that return a `Publisher<ReactiveSocket>`, it is now
obvious that the API is asynchronous.

***Modification***
I found a bug in `sourceToFactory`, where I was calling `subscriber.onSubscribe`
before initializing the `current` Map.
sourceToFactory(source, filterConnector);
LoadBalancer<T> loadBalancer = new LoadBalancer<>(factories);

scheduledFuture = executor.scheduleAtFixedRate(() -> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should do null check for executor in withExecutor, since you are assuming it to be non-null.

@NiteshKant
Copy link
Copy Markdown
Contributor

👍 apart from the small comments.

@NiteshKant NiteshKant merged commit 5f8280f into master Jul 12, 2016
@NiteshKant NiteshKant added this to the 0.2.2 milestone Jul 12, 2016
@stevegury stevegury deleted the stevegury/clientbuilder_async_build branch July 13, 2016 19:37
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.

2 participants