Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Dependency tree built

Hi,

On Fri, Sep 18, 2015 at 8:51 AM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> Hi
>
> If I just remove all the override part. The results seems not the same.
>
>     childpath.add("img/clink/clinklittle128.png");
>
>     childpath.add("js/preloadjs.min.js");
>
>     childpath.add("index.html");
>
>     childpath.add("css/infocard.css");
>
>
>      session.newStream(new HeadersFrame(metaDataA, null, true), new
> Promise<Stream>()
>
>     {
>
>         @Override
>
>         public void succeeded(Stream stream)
>
>         {
>
>             // Now we have the streamId.
>
>             int streamIdA = stream.getId();
>
>             System.out.println(streamIdA);
>
>             MetaData.Request metaDataB = new MetaData.Request("GET", new
> HttpURI("https://"+host+":"+port+"/"+childpath.get(1)), HttpVersion.HTTP_2,
> requestFields);
>
>             session.newStream(new HeadersFrame(metaDataB, new
>
>     PriorityFrame(streamIdA, 1, false), true), new
>
>     Promise.Adapter<>(), new Stream.Listener.Adapter()    );
>
>             MetaData.Request metaDataC = new MetaData.Request("GET", new
> HttpURI("https://"+host+":"+port+"/"+childpath.get(2)), HttpVersion.HTTP_2,
> requestFields);
>
>             session.newStream(new HeadersFrame(metaDataC, new
>
>     PriorityFrame(streamIdA, 256, true), true), new
>
>     Promise.Adapter<>(), new Stream.Listener.Adapter() );
>
>             MetaData.Request metaDataD = new MetaData.Request("GET", new
> HttpURI("https://"+host+":"+port+"/"+childpath.get(3)), HttpVersion.HTTP_2,
> requestFields);
>
>             session.newStream(new HeadersFrame(metaDataD, new
>
>     PriorityFrame(streamIdA, 1, false), true), new
>
>     Promise.Adapter<>(), new Stream.Listener.Adapter() );
>
>        }
>
>
> @Override
>
> public void failed(Throwable x) {
>
> // TODO Auto-generated method stub
>
> }
>
>     }, new Stream.Listener.Adapter()
>
>
>
>     );
>
>
> Weights and exclusive has no influence on the results. My server logs keeps
> this order
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET /index.html HTTP/2" 200 8215
> "-" "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET /css/infocard.css HTTP/2"
> 200 2800 "-" "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET /js/preloadjs.min.js HTTP/2"
> 200 30839 "-" "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
> 127.0.0.1 - - [18/Sep/2015:14:48:22 +0800] "GET
> /img/clink/clinklittle128.png HTTP/2" 200 2318863 "-"
> "org.eclipse.jetty.http2.client.HTTP2Client/9.3.4-SNAPSHOT"
>
>
> Do you know why?

There is a disconnect between the code you show, what you expect it
happens and what the server does.
Your code above says that at childpath[2]==index.html, so you are
probably asking it twice.

You have also to realize that it takes some time for the frames to be
sent, so it may be that your server has already fully processed the
request before it can reason about priorities.
Also, what the server prints in its logs may not in the same order of
the received frames, or processed requests.

I still don't understand what you are trying to do.

If you are trying to request A, then B, then C with a bigger weight
than B, then ask C first and then B.
You don't need priorities.

If you want to exercise priorities, you have to make B a really large
file that takes time to be sent back, so that C has the time to arrive
to the server, be priority-processed, so that the server pauses B to
send C.

If you override onData(), you have to make sure to call succeed() on
the callback, otherwise the client will stop reading from the socket
(after a while).

Please state exactly what you want to achieve, and what the problem is.

Thanks !

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top