java - Failure initializing default SSL context -
i making phone call rest url
, trying measure how much time taking response back.
i using defaulthttpclient
response rest url
.
in below programme , each thread working on particular range. each thread work between 1 - 100
, sec thread work between 101 - 200
etc.
so in below code, working sometime me after sometime throws me exception as
failure initializing default ssl context
and error well-
i/o exception (java.net.socketexception) caught when connecting target host: no buffer space available (maximum connections reached?): connect
is there wrong doing here?- or can utilize improve clients apart defaulthttpclient
create restful call.
below code-
class task implements runnable { private defaulthttpclient httpclient; private httpresponse response; @override public void run() { seek { (int userid = id; userid < id + nooftasks; userid++) { httpclient = new defaulthttpclient(); httpget httpget = new httpget("http://localhost:8080/service/beservice/v1/get/userid=10000/profile.account.service"); long start = system.nanotime(); response = httpclient.execute(httpget); long end = system.nanotime() - start; httpentity entity = response.getentity(); entityutils.consume(entity); } } grab (exception e) { log.error("threw exception in " + getclass().getsimplename(), e); } { httpclient.getconnectionmanager().shutdown(); } } }
if there wrong code. how can improve it?
i don't see wrong code error message you're seeing sounds more os level error.
there article might reply you: http://support.microsoft.com/kb/2577795
java json rest ssl apache-httpclient-4.x
No comments:
Post a Comment