Skip to content

Make HttpTransactionContext#getAsyncHandler public #1135

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

Merged
merged 1 commit into from
May 5, 2016

Conversation

elrodro83
Copy link

In our application, we need to access the work manager, since we are using a custom implementation of org.glassfish.grizzly.strategies.AbstractIOStrategy to get the Executor we need.

Making this method public allows us to properly implement that.

@oleksiys
Copy link
Contributor

oleksiys commented Apr 6, 2016

Could you pls. share how exactly you update the strategy?
Did you try to modify the Executor via com.ning.http.client.providers.grizzly.TransportCustomizer?

    final GrizzlyAsyncHttpProviderConfig config = new GrizzlyAsyncHttpProviderConfig();
    config.addProperty(TRANSPORT_CUSTOMIZER, new TransportCustomizer() {
        @Override
        public void customize(TCPNIOTransport transport, FilterChainBuilder builder) {
               // modify transport here
        }
    });

@elrodro83
Copy link
Author

Yes, that's what we're doing to set the strategy. Then, from within that strategy (on the getThreadPool() method), we need to get the asyncHandler that was sent with the request when calling

httpProvider.execute(request, asyncHandler);

since we are sending there the executor where the response has to be processed.

@slandelle
Copy link
Contributor

Is this PR still valid?

@elrodro83
Copy link
Author

Yes it is. Even if it won't be merged, we need to discuss how to obtain that object through another way.

@slandelle
Copy link
Contributor

OK, I'll let @oleksiys handle this then :)

@LucianoGandini
Copy link

Hi @oleksiys we are near to a new release, did you have time to review this PR?
We'll really appreciate your help.

Thanks in advance.

@oleksiys
Copy link
Contributor

Hi guys,

sorry for the delay, I'm currently on vacation. Will check and fix this next week.

Thank you!

@LucianoGandini
Copy link

LucianoGandini commented Apr 26, 2016

Thank you Alexey, We'll wait for you to be back then, enjoy your vacations!

Best.

@oleksiys
Copy link
Contributor

oleksiys commented May 2, 2016

Hi guys,

I want to understand more your usecase. If you need all of these just to set the custom thread pool - there is easier way to do that.
Is there anything else you're concerned about besides thread pool?

@slandelle slandelle added this to the 1.9.39 milestone May 3, 2016
@dfeist
Copy link

dfeist commented May 3, 2016

@oleksiys This was just to pass threadPool yes, which is not available statically. What other approach would you use for this?

@oleksiys
Copy link
Contributor

oleksiys commented May 4, 2016

@dfeist do you guys need to set a thread pool per request, or it's per client instance?

@dfeist
Copy link

dfeist commented May 4, 2016

@oleksiys Per-request. It's not there there is a new/different thread pool for each request of course, just that a single client is being reused for multiple 'flows' and each flow has it's own thread-pool, if that makes sense. The options I see are:
i) We use multiple client instances, which we want to avoid.
ii) We continue to use this hack
iii) We use SameThreadIOStrategy and do the thread hand-off to our own thread-pool only once HTTP client return, but the idea was to avoid this, and dispatch to worker thread as soon as possible.
iv) We work out a cleaner way to provide reference to Thread Pool per request.

@oleksiys oleksiys merged commit d01eeca into AsyncHttpClient:1.9.x May 5, 2016
@oleksiys
Copy link
Contributor

oleksiys commented May 5, 2016

Ok, I merge the pull request. I don't see better way to pass the request related information w/o changing AHC API.
Thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants