<div dir="ltr"><div class="gmail_default" style="font-family:'comic sans ms',sans-serif">Hi,</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif"><br></div><div class="gmail_default">
<div class="gmail_default"><font face="comic sans ms, sans-serif">I am pretty sure, 15 sec. delay is enough to open additional browsers windows ;-)</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif"><br>
</font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">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.</font></div><div class="gmail_default">
<font face="comic sans ms, sans-serif"><br></font></div><div class="gmail_default"><font face="comic sans ms, sans-serif">So, could anybody reproduce this issue or give me feedback where is my error?</font></div></div></div>
<div class="gmail_extra"><br clear="all"><div>Best,<br>Mikhail</div>
<br><br><div class="gmail_quote">2014-02-18 5:22 GMT+02:00 Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Are you sure the requests are actually being made simultaneously? That code should definitely work.<br>
<br>
Stuart<br>
<div><div class="h5"><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>
</div></div>> _______________________________________________<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>
</blockquote></div><br></div>