Skip to content

Commit

Permalink
Merge pull request #4 from mosharaf/master
Browse files Browse the repository at this point in the history
RandomAccessFiles are not thread-safe.
  • Loading branch information
mosharaf committed Aug 2, 2014
2 parents 9ef8d93 + f622016 commit c427909
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/src/main/scala/varys/examples/BroadcastService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,10 @@ private[varys] object BroadcastReceiver extends Logging {
logInfo("Got " + blockName + " of " + bArr.length + " bytes. Writing to " + localPathToFile +
" at " + offset)

FILE.seek(offset)
FILE.write(bArr)
FILE.synchronized {
FILE.seek(offset)
FILE.write(bArr)
}
})

Await.result(futureList, Duration.Inf)
Expand Down

0 comments on commit c427909

Please sign in to comment.