<div dir="ltr"><div>Hi, Jason.</div><div><br></div><div>Thank you for your explanation. I got it.</div><div><br></div><div>[FYI]</div><div>>>> I tried with Safari and it works as expected.</div><div><br></div><div>
I checked IE8(sorry for legacy...) also don't reuse connection.</div><div><br></div><div>===</div><div>Yoshimasa Tanabe</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 20, 2014 at 7:47 AM, Jason Greene <span dir="ltr"><<a href="mailto:jason.greene@redhat.com" target="_blank">jason.greene@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It all depends on how the web browser manages connections. Some prefer to reuse aggressively and others don’t.<br>
<br>
The way the undertow architecture works, is that every connection is assigned to an I/O thread for as long as that connection is alive. When there is data available the I/O thread will wake up and process that data, and trigger a call to your handler, and move on to other ready connections.<br>
<div class="HOEnZb"><div class="h5"><br>
On Feb 19, 2014, at 11:53 AM, Mikhail Tyamin <<a href="mailto:mikhail.tiamine@gmail.com">mikhail.tiamine@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> you are right! I tried with Safari and it works as expected.<br>
><br>
> Maybe somebody from undertow's team could explain why?<br>
><br>
> Best,<br>
> Mikhail<br>
><br>
> Best,<br>
> Mikhail<br>
><br>
><br>
> 2014-02-18 16:50 GMT+02:00 lanabe <<a href="mailto:lanabe.lanabe@gmail.com">lanabe.lanabe@gmail.com</a>>:<br>
> Hi, Mikhail.<br>
><br>
> I got the same log.<br>
><br>
> [environment]<br>
> Undertow: io.undertow:undertow-core:1.0.0.Final<br>
> OS: Fedora19(64bit)<br>
> JDK: OpenJDK 1.7.0_51<br>
> Client: Google Chrome 32.0.1700.107, Firefox 26.0<br>
><br>
> ---<br>
> Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> Thread #XNIO-1 task-1 Start waiting<br>
> Thread #XNIO-1 task-1 Finish waiting<br>
><br>
> Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> Thread #XNIO-1 task-2 Start waiting<br>
> Thread #XNIO-1 task-2 Finish waiting<br>
><br>
> Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> Thread #XNIO-1 task-3 Start waiting<br>
> Thread #XNIO-1 task-3 Finish waiting<br>
> ---<br>
><br>
> but, I got the expected following log by using curl.<br>
> ---<br>
> Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> Thread #XNIO-1 task-1 Start waiting<br>
> Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> Thread #XNIO-1 task-2 Start waiting<br>
> Thread #XNIO-1 I/O-2 is I/O : handle this<br>
> Thread #XNIO-1 task-3 Start waiting<br>
> Thread #XNIO-1 task-1 Finish waiting<br>
><br>
> Thread #XNIO-1 task-2 Finish waiting<br>
><br>
> Thread #XNIO-1 task-3 Finish waiting<br>
> ---<br>
><br>
> hmm...Does it depends on browser settings?<br>
><br>
> Yoshimasa Tanabe<br>
><br>
><br>
> On Tue, Feb 18, 2014 at 3:10 PM, Mikhail Tyamin <<a href="mailto:mikhail.tiamine@gmail.com">mikhail.tiamine@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I am pretty sure, 15 sec. delay is enough to open additional browsers windows ;-)<br>
><br>
> I try to run code with io.undertow:undertow-core:1.0.0.Final on mac with OS X 10.9.1 with jdk 1.7.0_51.<br>
><br>
> So, could anybody reproduce this issue or give me feedback where is my error?<br>
><br>
> Best,<br>
> Mikhail<br>
><br>
><br>
> 2014-02-18 5:22 GMT+02:00 Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>>:<br>
><br>
> Are you sure the requests are actually being made simultaneously? That code should definitely work.<br>
><br>
> Stuart<br>
><br>
><br>
> ----- Original Message -----<br>
> > From: "Mikhail Tyamin" <<a href="mailto:mikhail.tiamine@gmail.com">mikhail.tiamine@gmail.com</a>><br>
> > To: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> > Sent: Monday, 17 February, 2014 3:03:41 PM<br>
> > Subject: [undertow-dev] what I do wrong?<br>
> ><br>
> > Hello guys,<br>
> ><br>
> > could you help me a little bit with Undertow?<br>
> ><br>
> > I follow all instructions in Undertown's poor documentation. So here is the<br>
> > class :<br>
> ><br>
> > public class HelloWorldServer {<br>
> ><br>
> > public static void main(String... args) {<br>
> > Undertow server = Undertow.builder()<br>
> > .addHttpListener(8080, "localhost")<br>
> > .setHandler(new HttpHandler() {<br>
> > @Override<br>
> > public void handleRequest(final HttpServerExchange exchange) throws Exception<br>
> > {<br>
> > if (exchange.isInIoThread()) {<br>
> > System.out.println("Thread #" + Thread.currentThread().getName() + " is I/O :<br>
> > handle this");<br>
> > exchange.dispatch(this);<br>
> > return;<br>
> > }<br>
> ><br>
> > //[1]<br>
> > System.out.println("Thread #" + Thread.currentThread().getName() + " Start<br>
> > waiting");<br>
> > Thread.sleep(15000);<br>
> > System.out.println("Thread #" + Thread.currentThread().getName() + " Finish<br>
> > waiting");<br>
> ><br>
> > System.out.println();<br>
> ><br>
> > exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");<br>
> > exchange.getResponseSender().send("Hello world from thread " +<br>
> > Thread.currentThread().getId());<br>
> > //[2]<br>
> > }<br>
> > }).build();<br>
> ><br>
> > server.start();<br>
> > }<br>
> > }<br>
> ><br>
> > When I start it and make three http get request simultaneously I can see this<br>
> > output in console :<br>
> ><br>
> > Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> > Thread #XNIO-1 task-1 Start waiting<br>
> > Thread #XNIO-1 task-1 Finish waiting<br>
> ><br>
> > Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> > Thread #XNIO-1 task-2 Start waiting<br>
> > Thread #XNIO-1 task-2 Finish waiting<br>
> ><br>
> > Thread #XNIO-1 I/O-1 is I/O : handle this<br>
> > Thread #XNIO-1 task-3 Start waiting<br>
> > Thread #XNIO-1 task-3 Finish waiting<br>
> ><br>
> ><br>
> > I think that code beetween //[1] and //[2] should perform in separate thread<br>
> > (and as we can see from the console it really does), but why the main I/O<br>
> > thread are waiting and does not handle other requests?<br>
> ><br>
> > So if my code is correct than it means that Undertow could handle one request<br>
> > in time...<br>
> ><br>
> > What I do wrong?<br>
> ><br>
> > Best,<br>
> > Mikhail<br>
> ><br>
> > _______________________________________________<br>
> > undertow-dev mailing list<br>
> > <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> > <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
><br>
><br>
> _______________________________________________<br>
> undertow-dev mailing list<br>
> <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
><br>
><br>
> _______________________________________________<br>
> undertow-dev mailing list<br>
> <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
<br>
</div></div><div class="HOEnZb"><div class="h5">--<br>
Jason T. Greene<br>
WildFly Lead / JBoss EAP Platform Architect<br>
JBoss, a division of Red Hat<br>
<br>
</div></div></blockquote></div><br></div></div>