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