java - Thread is blocked when use restTemplate -
i encounter problem threads of app has locked/blocked when communicate remote server using spring's resttemplate.
here jstack info of 1 blocked thread:
"pool-1-thread-8" prio=10 tid=0x00007fbfd012d800 nid=0x27b1 runnable [0x00007fbfd7dfb000] java.lang.thread.state: runnable @ java.net.socketinputstream.socketread0(native method) @ java.net.socketinputstream.read(socketinputstream.java:129) @ java.io.bufferedinputstream.fill(bufferedinputstream.java:218) @ java.io.bufferedinputstream.read1(bufferedinputstream.java:258) @ java.io.bufferedinputstream.read(bufferedinputstream.java:317) - locked <0x00007fbfe40fe1f8> (a java.io.bufferedinputstream) @ sun.net.www.http.httpclient.parsehttpheader(httpclient.java:687) @ sun.net.www.http.httpclient.parsehttp(httpclient.java:632) @ sun.net.www.protocol.http.httpurlconnection.getinputstream(httpurlconnection.java:1072) - locked <0x00007fbfe40fe2f0> (a sun.net.www.protocol.http.httpurlconnection) @ java.net.httpurlconnection.getresponsecode(httpurlconnection.java:373) @ org.springframework.http.client.simpleclienthttpresponse.getrawstatuscode(simpleclienthttpresponse.java:47) @ org.springframework.http.client.abstractclienthttpresponse.getstatuscode(abstractclienthttpresponse.java:32) @ org.springframework.web.client.defaultresponseerrorhandler.gethttpstatuscode(defaultresponseerrorhandler.java:55) @ org.springframework.web.client.defaultresponseerrorhandler.haserror(defaultresponseerrorhandler.java:49) @ org.springframework.web.client.resttemplate.doexecute(resttemplate.java:489) @ org.springframework.web.client.resttemplate.execute(resttemplate.java:452) @ org.springframework.web.client.resttemplate.postforobject(resttemplate.java:302) @ com.xxx.activation.service.action.impl.restserviceimpl.sendcontactrequest(restserviceimpl.java:37) @ com.xxx.activation.service.action.impl.sendcontactrequestaction.perform(sendcontactrequestaction.java:125) @ com.xxx.activation.service.action.impl.defaultstateactionservice.doaction(defaultstateactionservice.java:75) @ com.xxx.activation.service.action.impl.actionprocess$stateactiontask.call(actionprocess.java:54) @ com.xxx.activation.service.action.impl.actionprocess$stateactiontask.call(actionprocess.java:41) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303) @ java.util.concurrent.futuretask.run(futuretask.java:138) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ java.lang.thread.run(thread.java:619)
how can solve this?
related readtimeout of java.net.urlconnection?
what's default values of connecttimeout , readtimeout of underlying socket when using sring's resttemplate?
thanks in advance.
a post here describes problem
try setting time out rest call , make sure rest service , running. check if indeed rest service trying fetch huge amount of information.
Comments
Post a Comment