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

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?

Best Regards

Muhui Jiang


2015-09-18 14:30 GMT+08:00 Muhui Jiang <jiangmuhui@xxxxxxxxx>:
Hi

Having finished the test according to your hint. The results seems good. The h2o is trying to send back all the dataframes of A before send the headersframe of B & C. But sometimes if A is too large, A won't be the first one finished. I think this exactly reflect the feature of priority. 

And I have also tried the exclusive flag. It can also works. 

By the way, if I just override the  ondata, onheader function in the Adapter without using phaser. Do you think this will influence or not? I got the result above from the log of my server. But the client can not print all the information till all the frames finished.

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()    {


    @Override

    public void onHeaders(Stream stream, HeadersFrame frame) {

    // TODO Auto-generated method stub

    System.err.println(frame+childpath.get(1));

    }


    @Override

    public Listener onPush(Stream stream, PushPromiseFrame frame) {

    // TODO Auto-generated method stub

    System.err.println(frame+childpath.get(1));

    return this;

    }


    @Override

    public void onData(Stream stream, DataFrame frame,

    Callback callback) {

    // TODO Auto-generated method stub

    System.err.println(frame+childpath.get(1));

    }

        

        });

            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, false), true), new

    Promise.Adapter<>(), new Stream.Listener.Adapter()    {


    @Override

    public void onHeaders(Stream stream, HeadersFrame frame) {

    // TODO Auto-generated method stub

    System.err.println(frame+childpath.get(2));

    }


    @Override

    public Listener onPush(Stream stream, PushPromiseFrame frame) {

    // TODO Auto-generated method stub

    System.err.println(frame+childpath.get(2));

    return this;

    }


    @Override

    public void onData(Stream stream, DataFrame frame,

    Callback callback) {

    // TODO Auto-generated method stub

    System.err.println(frame+childpath.get(2));

    }       

        });


Just like my childpath here:

    childpath.add("img/clink/clinklittle128.png");

    childpath.add("js/preloadjs.min.js");

    childpath.add("index.html");         

    childpath.add("css/infocard.css");

The result:

HeadersFrame@66f8ef24#1{end=false}

DataFrame@194fa782#1{length:1294,end=false}

DataFrame@41fda58b#1{length:1400,end=false}

DataFrame@4d402512#1{length:1400,end=false}

DataFrame@62eb2312#1{length:1400,end=false}

DataFrame@6fceb7a#1{length:1400,end=false}

DataFrame@2a81c7d3#1{length:1400,end=false}

DataFrame@66a50f24#1{length:1400,end=false}

DataFrame@5d6d5351#1{length:1400,end=false}

DataFrame@3c2bd4bd#1{length:1400,end=false}

DataFrame@183033b4#1{length:1400,end=false}

DataFrame@5622d3b9#1{length:1400,end=false}

DataFrame@6162f5f7#1{length:1090,end=false}

DataFrame@38e5b5a#1{length:301,end=false}

DataFrame@1a3a750c#1{length:1400,end=false}

DataFrame@5ac5c2e9#1{length:1400,end=false}

DataFrame@2cfe590b#1{length:1400,end=false}

DataFrame@5d5b8345#1{length:1400,end=false}

DataFrame@14801ff7#1{length:1400,end=false}

DataFrame@60a65504#1{length:1400,end=false}

DataFrame@3e4e6e1a#1{length:1400,end=false}

DataFrame@3f0e933d#1{length:1400,end=false}

DataFrame@2be55c8c#1{length:1400,end=false}

DataFrame@79b92281#1{length:1400,end=false}

DataFrame@344aad12#1{length:1400,end=false}

DataFrame@7f1657dd#1{length:683,end=false}

DataFrame@7e16658f#1{length:708,end=false}

DataFrame@4e0bede6#1{length:1400,end=false}

DataFrame@2fc8eb08#1{length:1400,end=false}

DataFrame@62adf993#1{length:1400,end=false}

DataFrame@2f5ac254#1{length:1400,end=false}

DataFrame@3eaf7e84#1{length:1400,end=false}

DataFrame@565752f2#1{length:1400,end=false}

DataFrame@5bbb48ca#1{length:1400,end=false}

DataFrame@220a698b#1{length:1400,end=false}

DataFrame@67947810#1{length:1400,end=false}

DataFrame@b3876d2#1{length:1400,end=false}

DataFrame@a449267#1{length:1400,end=false}

DataFrame@7bf3f495#1{length:276,end=false}

DataFrame@3f635703#1{length:1115,end=false}

DataFrame@772528db#1{length:1400,end=false}

DataFrame@595c5bf2#1{length:1400,end=false}

DataFrame@3def4b10#1{length:1400,end=false}

DataFrame@1891d8e1#1{length:1400,end=false}

DataFrame@46ac58d8#1{length:1400,end=false}

DataFrame@7d140834#1{length:1400,end=false}

DataFrame@3ae46b4d#1{length:1400,end=false}

DataFrame@2ca4fa20#1{length:1400,end=false}

DataFrame@86a1df4#1{length:1400,end=false}

DataFrame@5562e165#1{length:1400,end=false}

DataFrame@4c455687#1{length:1268,end=false}

HeadersFrame@47bbc0d5#3{end=false}js/preloadjs.min.js

HeadersFrame@1f66f06b#5{end=false}index.html

HeadersFrame@5d4d532b#7{end=false}css/infocard.css

Best Regards

Muhui Jiang


2015-09-17 15:36 GMT+08:00 Simone Bordet <sbordet@xxxxxxxxxxx>:
Hi,

On Thu, Sep 17, 2015 at 4:45 AM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> Hi.
>
> DId you mean that I need to listen to  the headersframe of A sent by server
> and let the B & C depend on the streamId of the headersframe we heard.

No I mean you need to wait for the client-side HEADERS frame to be sent:

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();
        session.newStream(new HeadersFrame(metaDataB, new
PriorityFrame(streamIdA, weightB, false), true), new
Promise.Adapter<>(), new Stream.Listener.Adapter());
        session.newStream(new HeadersFrame(metaDataC, new
PriorityFrame(streamIdA, weightC, false), true), new
Promise.Adapter<>(), new Stream.Listener.Adapter());
   }
}, new Stream.Listener.Adapter());

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top