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

I run the main method successfully, and it seems the result still not good.

Here is the code, I am using the phase to start the thread at the same time:

public class Client

{

static String host = "127.0.0.1";

    static int port = 8081;

    static ArrayList<String> childpath = new ArrayList<String>();

    static ArrayList<HeadersFrame> myHeadersFrames = new ArrayList<HeadersFrame>();

    public static void main(String[] args) throws Exception

    {

        childpath.add("index.html");

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

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

        


        HTTP2Client client = new HTTP2Client();

        SslContextFactory sslContextFactory = new SslContextFactory();

        client.addBean(sslContextFactory);

        client.start();

        FuturePromise<Session> sessionPromise = new FuturePromise<>();

        client.connect(sslContextFactory, new InetSocketAddress(host, port), new ServerSessionListener.Adapter(), sessionPromise);

        Session session = sessionPromise.get(5, TimeUnit.SECONDS);


        HttpFields requestFields = new HttpFields();

        requestFields.put("User-Agent", client.getClass().getName() + "/" + Jetty.VERSION);

   

        

    for(int id =0;id<childpath.size();id++)

    {

    MetaData.Request metaData = new MetaData.Request("GET", new HttpURI("https://"+host+":"+port+"/"+childpath.get(id)), HttpVersion.HTTP_2, requestFields);

if(id == 0)

{

    HeadersFrame headersFrame = new HeadersFrame( metaData, null, true);

    myHeadersFrames.add(headersFrame);

}

if(id == 1)

{

    HeadersFrame headersFrame = new HeadersFrame( metaData,  new PriorityFrame(myHeadersFrames.get(0).getStreamId(), 256, false), true);

    myHeadersFrames.add(headersFrame);

}

if(id == 2)

{

    HeadersFrame headersFrame = new HeadersFrame( metaData,  new PriorityFrame(myHeadersFrames.get(0).getStreamId(), 16, false), true);

    myHeadersFrames.add(headersFrame);

}

    }

        //final Phaser phaser = new Phaser(2);

        final int count = childpath.size();  

        final Phaser phaser = new Phaser(childpath.size());  

        for(int i = 0; i < count; i++) {  

            System.out.println("starting thread, id: " + i+"streamid:" + myHeadersFrames.get(i).getStreamId());  

            final Thread thread = new Thread(new Task(i, phaser,session,requestFields,childpath.get(i)));  

            thread.start();  

        }   

    }

    public static class Task implements Runnable {  

        //  

        private final int id;  

        private final Phaser phaser;  

        private final Session session;

        private final HttpFields requestFields;

        private final String childpathvalue;

  

        public Task(int id, Phaser phaser,Session session,HttpFields requestFields,String childpathvalue) {  

            this.id = id;  

            this.phaser = phaser;  

            this.session = session;

            this.requestFields = requestFields;

            this.childpathvalue = childpathvalue;

        }  

          

        @Override  

        public void run() {  

         phaser.arriveAndAwaitAdvance();

            System.out.println("in Task.run(), phase: " + phaser.getPhase() + ", id: " + this.id);  

        PriorityFrame tempPriorityFrame = null;

        //System.out.println(myHeadersFrames.get(id).getPriority()+"streamID:"+myHeadersFrames.get(id).getStreamId());

        

        session.newStream(myHeadersFrames.get(id), new Promise.Adapter<Stream>(), new Stream.Listener.Adapter()

        {

            @Override

            public void onHeaders(Stream stream, HeadersFrame frame)

            {

                System.err.println(frame+"https://"+host+":"+port+"/"+childpath.get(id));

                //System.out.println();

                if (frame.isEndStream())

                {

                //System.out.println(phaser.);

                    phaser.arrive();

                }

            }


            @Override

            public void onData(Stream stream, DataFrame frame, Callback callback)

            {

                System.err.println(frame+"https://"+host+":"+port+"/"+childpath.get(id));

                callback.succeeded();

                if (frame.isEndStream())

                    phaser.arrive();

            }


            @Override

            public Stream.Listener onPush(Stream stream, PushPromiseFrame frame)

            {

                System.err.println(frame+"https://"+host+":"+port+"/"+childpath.get(id));

                phaser.register();

                return this;

            }

        });

        

        //phaser.awaitAdvance(phaser.arrive());

      try {

phaser.awaitAdvanceInterruptibly(phaser.arrive(), 5, TimeUnit.SECONDS);

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (TimeoutException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}    

        }  

    }  

}

But the result here :

HeadersFrame@6e384319#1{end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@5723bcc1#1{length:1286,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@4257b949#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@171ebc37#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@b164b18#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@41192b0f#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@3e7b4f94#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@5ce6a368#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@65917d67#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@6d587389#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@93b9659#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@602f89f5#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@e3baad2#1{length:1098,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@205144a7#1{length:293,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@750d97aa#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@69f1c8df#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@3acf9209#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@10119d8b#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@938f8e4#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@6e687e2c#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@2871e632#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@3490cb72#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@7aa1fadc#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@579572ba#1{length:1400,end=false}https://127.0.0.1:8081/js/preloadjs.min.js

DataFrame@70f25e0c#1{length:162,end=true}https://127.0.0.1:8081/js/preloadjs.min.js

HeadersFrame@420bd03b#3{end=false}https://127.0.0.1:8081/css/foundation.css

HeadersFrame@3709a5bc#5{end=false}https://127.0.0.1:8081/index.html

DataFrame@4b751145#3{length:1271,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@29153419#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@2c411bd6#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@2cf447bb#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@4c7aace#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@2519094b#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@1222995#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@fe57f95#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@36cd357d#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@5bf321be#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@4b8dd5d4#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@6fb002e7#3{length:1113,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@3009a4b1#5{length:278,end=false}https://127.0.0.1:8081/index.html

DataFrame@72b58ddf#5{length:1400,end=false}https://127.0.0.1:8081/index.html

DataFrame@5733d528#5{length:1400,end=false}https://127.0.0.1:8081/index.html

DataFrame@38fb5213#5{length:1400,end=false}https://127.0.0.1:8081/index.html

DataFrame@45aa4591#5{length:1400,end=false}https://127.0.0.1:8081/index.html

DataFrame@1baff38e#5{length:1400,end=false}https://127.0.0.1:8081/index.html

DataFrame@527cff46#5{length:937,end=true}https://127.0.0.1:8081/index.html

DataFrame@307554d0#3{length:454,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@27641982#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@4333bd63#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@7600ec8c#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@6c49e548#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@6b66594a#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@35e029e0#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@44f5c75c#3{length:1243,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@6735092f#3{length:1391,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@3ec0b08a#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@a5b219b#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@607ed8ab#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@2f4dd9fa#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@14b27879#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@47b6c48d#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@519be750#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@10586690#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@172ea552#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@66cd9996#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@68e25378#3{length:993,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@3b5dc412#3{length:398,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@593bf21e#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@5330d186#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@29b3310b#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@7c1b0d7b#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@7a36abe4#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@2f5fe9c5#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@1f54be4c#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@3b801808#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@74a6ed17#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@24672387#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@1e7b5f99#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@25805406#3{length:586,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@668dcbf4#3{length:742,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@7bebb7b9#3{length:1391,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@3f28b8ca#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@182feb4d#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@107541d7#3{length:1353,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@36856a1f#3{length:1391,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@4c917aed#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@2b0385b1#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@11c212ff#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@c8a574a#3{length:1400,end=false}https://127.0.0.1:8081/css/foundation.css

DataFrame@4b0b1224#3{length:949,end=true}https://127.0.0.1:8081/css/foundation.css

There is always a request going to be finished before the other two's headersframe being sent. And the first one being sent is in random


2015-09-16 22:50 GMT+08:00 Simone Bordet <sbordet@xxxxxxxxxxx>:
Hi,

On Tue, Sep 15, 2015 at 6:54 PM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> Hi:
>
> The exec-maven-plugin not start when I build.

Because it's not bound to any phase.

After the normal build just run it using:

$ mvn exec:java

--
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