java.util.concurrent.RejectedExecutionException: org.eclipse.jetty.client.HttpClient -


i running following program on jetty asynchronous http client.

  code  public static void main(string[] args) throws interruptedexception, timeoutexception, executionexception {             string url2="http://www.google.co.in";          //  jettyhttp.sendhttpsyncreq(url2);             jettyhttp.sendhttpasyncreq(url2);      }     public static void sendhttpasyncreq(string url) throws interruptedexception, timeoutexception, executionexception     {         sslcontextfactory sslcontextfactory = new sslcontextfactory();         httpclient httpclient =new httpclient(sslcontextfactory);         long total_t1=system.currenttimemillis();           httpclient.newrequest(url).send(new response.completelistener() {              @override             public void oncomplete(result arg0) {                 // todo auto-generated method stub              }         });          long total_t2=system.currenttimemillis();         system.out.println(total_t2-total_t1 +" ==");       } 

error getting is

 exception in thread "main" java.util.concurrent.rejectedexecutionexception: org.eclipse.jetty.client.httpclient@412429c stopped     @ org.eclipse.jetty.client.httpdestination.send(httpdestination.java:198)     @ org.eclipse.jetty.client.httpclient.send(httpclient.java:485)     @ org.eclipse.jetty.client.httprequest.send(httprequest.java:486)     @ org.eclipse.jetty.client.httprequest.send(httprequest.java:479)     @ com.nielsen.http.jettyhttp.sendhttpasyncreq(jettyhttp.java:38)     @ com.nielsen.http.jettyhttp.main(jettyhttp.java:28)  

please me in out of error::

you forgot start httpclient.

sslcontextfactory sslcontextfactory = new sslcontextfactory(); httpclient httpclient =new httpclient(sslcontextfactory); httpclient.start(); 

keep in mind need 1 httpclient of requests , connections. httpclient object fits in same logical role browser, managing many tabs of connections.


Comments