Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/577#discussion_r12303501
--- Diff:
core/src/main/scala/org/apache/spark/broadcast/HttpBroadcast.scala ---
@@ -159,18 +159,24 @@ private[spark] object HttpBroadcast extends Logging {
def write(id: Long, value: Any) {
val file = getFile(id)
- val out: OutputStream = {
- if (compress) {
- compressionCodec.compressedOutputStream(new FileOutputStream(file))
- } else {
- new BufferedOutputStream(new FileOutputStream(file), bufferSize)
+ val fileOutputStream = new FileOutputStream(file)
+ try {
+ val out: OutputStream = {
+ if (compress) {
+ compressionCodec.compressedOutputStream(fileOutputStream)
+ } else {
+ new BufferedOutputStream(fileOutputStream, bufferSize)
+ }
}
+ val ser = SparkEnv.get.serializer.newInstance()
+ val serOut = ser.serializeStream(out)
+ serOut.writeObject(value)
+ serOut.close()
+ files += file.getAbsolutePath
+ }
--- End diff --
A code style thing throughput this PR: put the `finally` on the same line
as the `}` above
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---