question

Upvotes
Accepted
64 3 5 7

connection timeout

When I download the file after scheduler task compelted, I got followint error how to avoid error?

java.net.SocketException: Connection timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.sc.request.SchedulerTemplate.extractAndSaveFile(SchedulerTemplate.java:715)
at com.sc.request.SchedulerTemplate.getReportExtractionsFiles(SchedulerTemplate.java:673)
at com.sc.scheduler.CorpEvent.getCorpEventData(CorpEvent.java:68)
at com.sc.process.EventProcess.requestData(EventProcess.java:83)
at com.sc.process.EventProcess.main(EventProcess.java:47)
Saved file to hard disk.

tick-history-rest-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
35 1 3 5

It depends, usually timeout are related to network issue(slow connection etc...), you can try to write "transient fault handling" code to avoid exception and re-try download. I'm not a Java developer(.NET) but here you can find some information https://github.com/rbuck/java-retry

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea