Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove an excessive close after the abort call in S3RangeReader #3324

Merged
merged 1 commit into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Remove explicit unused Scaffeine dependency from projects [#3314](https://github.com/locationtech/geotrellis/pull/3314)
- Remove an excessive close after the abort call in S3RangeReader [#3324](https://github.com/locationtech/geotrellis/pull/3324)

## [3.5.1] - 2020-11-23

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GeoTrellis is currently available for Scala 2.11 and 2.12, using Spark 2.4.x.
To get started with SBT, simply add the following to your build.sbt file:

```scala
libraryDependencies += "org.locationtech.geotrellis" %% "geotrellis-raster" % "3.0.0"
libraryDependencies += "org.locationtech.geotrellis" %% "geotrellis-raster" % "<latest version>"
```

To grab the latest `SNAPSHOT`, `RC` or milestone build, add these resolvers:
Expand Down
13 changes: 12 additions & 1 deletion s3/src/main/scala/geotrellis/store/s3/util/S3RangeReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ class S3RangeReader(
val responseStream = client.getObject(request)
val length = responseStream.response.contentLength

/**
* The response stream is backed by [[org.apache.http.conn.EofSensorInputStream]].
* There is no need in closing the stream via close() after calling abort().
*
* abort() is a special version of close() which prevents
* re-use of the underlying connection, if any. Calling this method
* indicates that there should be no attempt to read until the end of
* the stream.
* * throws IOException in case of an IO problem on closing the underlying stream
*
* Source: https://github.com/apache/httpcomponents-core/blob/5.2.x/httpcore5/src/main/java/org/apache/hc/core5/http/io/EofSensorInputStream.java#L269-L283
*/
responseStream.abort()
responseStream.close()
length
}
}
Expand Down