[
https://issues.apache.org/jira/browse/HTTPCORE-205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12751643#action_12751643
]
Patrick Moore commented on HTTPCORE-205:
----------------------------------------
Hi Oleg --
I know you hate to hear this but ... because in the code I didn't see anything
to point this out.
I usually only get as far as javadoc with opensource (that is usually all the
doc available). :-) When I was stepping through the code, I did not "notice"
the ListenerEndPoint. (Suggestion here: in the java doc for:
ListenerEndpoint listen(SocketAddress address);
add this:
The returned ListenerEndPoint#waitFor() can be used to monitor when
connection is available.
see {...@linkplain
http://hc.apache.org/httpcomponents-core/tutorial/html/nio.html#d0e1207} for
more examples.
-----------------------------------------------------------------------
I AGREE that ListenerEndPoint looks to be the more correct solution.
Some problems however:
1) uses old wait-forever ( no ability to "give up" )
2) Cannot monitor a set of ListenerEndPoints all at once.
I suggest:
1) create a ListenerEndPointImplementor with all the methods defined in
ListenerEndPointImpl that are needed by ListeningIOReactor
2) create a ListeningIOReactor.listen(ListenerEndPointImplementor)
3) remove references to ListenerEndPointImpl in the various other classes.
This should address the key needs.
> AbstractMultiworkerIOReactor needs optional Latch to signal when ready.
> -----------------------------------------------------------------------
>
> Key: HTTPCORE-205
> URL: https://issues.apache.org/jira/browse/HTTPCORE-205
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Components: HttpCore NIO
> Affects Versions: 4.0.1
> Reporter: Patrick Moore
> Fix For: 4.1
>
> Attachments: AbstractMultiworkerIOReactor.patch
>
>
> AbstractMultiworkerIOReactor may take some time getting ready ( needs to
> start threads for example ). In order to ensure that it is ready before
> starting to send requests, a CountDownLatch is needed.
> This is important for our test suites which are launch the reactor and then
> immediately trying to hit it. ( and failing )
> for (int i = 0; i < this.workerCount; i++) {
> if (this.status != IOReactorStatus.ACTIVE) {
> return;
> }
> this.threads[i].start();
> }
> LINE 303: this.countDownLatch.countDown(); <<<<<<<
> for (;;) {
> int readyCount;
> try {
> readyCount = this.selector.select(this.selectTimeout);
> } catch (InterruptedIOException ex) {
> throw ex;
> } catch (IOException ex) {
> throw new IOReactorException("Unexpected selector
> failure", ex);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]