Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] OutOfMemoryError

Hi,

But before send request, we have do the things below.

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

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

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


    then we can make the request:

     session.new stream(.....)


If I have a array contains 10000sites. for example websites[10000];

Which things should be done 10000 times?

I have tried to start client once only. but I still failed.


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

On Sun, Sep 20, 2015 at 7:42 PM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> I tried to use jetty client to scan many website.
>
> But it seems every time I let the client start and it will creates a new
> thread

You have to start HttpClient once only.

Once that only instance is started, you can use it to scan as many
sites you want.

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