Saturday, August 3, 2019

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

I am running the following program on jetty asynchronous http client.





Code is
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 I am getting is





Exception in thread "main" java.util.concurrent.RejectedExecutionException: org.eclipse.jetty.client.HttpClient@412429c is stopped
at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:198)
at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:485)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:486)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:479)
at com.nielsen.http.JettyHttp.sendHttpAsyncReq(JettyHttp.java:38)
at com.nielsen.http.JettyHttp.main(JettyHttp.java:28)




Please Help me in this to get out of error::

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...