Files.copy超时

时间:2015-11-25 00:35:30

标签: java nio

Files.copy方法正在从连接到S3的输入流中读取。有时会超时。是否可以延长超时值?

val inputStream = bucket.get("foo").get.content
Files.copy(inputStream, localPath)

结果

java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_40]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_40]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[na:1.8.0_40]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_40]
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[na:1.8.0_40]
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:593) ~[na:1.8.0_40]
at sun.security.ssl.InputRecord.read(InputRecord.java:532) ~[na:1.8.0_40]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:961) ~[na:1.8.0_40]
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:918) ~[na:1.8.0_40]
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) ~[na:1.8.0_40]
at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:198) ~[httpcore-4.3.3.jar:4.3.3]
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178) ~[httpcore-4.3.3.jar:4.3.3]
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137) ~[httpclient-4.3.6.jar:4.3.6]
at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:72) ~[aws-java-sdk-core-1.10.26.jar:na]
at com.amazonaws.event.ProgressInputStream.read(ProgressInputStream.java:151) ~[aws-java-sdk-core-1.10.26.jar:na]
at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:72) ~[aws-java-sdk-core-1.10.26.jar:na]
at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:72) ~[aws-java-sdk-core-1.10.26.jar:na]
at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:72) ~[aws-java-sdk-core-1.10.26.jar:na]
at com.amazonaws.event.ProgressInputStream.read(ProgressInputStream.java:151) ~[aws-java-sdk-core-1.10.26.jar:na]
at java.security.DigestInputStream.read(DigestInputStream.java:161) ~[na:1.8.0_40]
at com.amazonaws.services.s3.internal.DigestValidationInputStream.read(DigestValidationInputStream.java:59) ~[aws-java-sdk-s3-1.10.26.jar:na]
at com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:72) ~[aws-java-sdk-core-1.10.26.jar:na]
at java.io.FilterInputStream.read(FilterInputStream.java:107) ~[na:1.8.0_40]
at java.nio.file.Files.copy(Files.java:2908) ~[na:1.8.0_40]
at java.nio.file.Files.copy(Files.java:3027) ~[na:1.8.0_40]

0 个答案:

没有答案