Skip to content

Commit

Permalink
fix thread safe
Browse files Browse the repository at this point in the history
  • Loading branch information
lianhuiwang committed Apr 21, 2016
1 parent 97fd174 commit e009d95
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private[spark] abstract class Spillable[C](taskMemoryManager: TaskMemoryManager)
protected def forceSpill(): Boolean

// Number of elements read from input since last spill
protected def elementsRead: Long = _elementsRead
@volatile protected def elementsRead: Long = _elementsRead

// Called by subclasses every time a record is read
// It's used for checking spilling frequency
Expand All @@ -59,13 +59,13 @@ private[spark] abstract class Spillable[C](taskMemoryManager: TaskMemoryManager)

// Threshold for this collection's size in bytes before we start tracking its memory usage
// To avoid a large number of small spills, initialize this to a value orders of magnitude > 0
private[this] var myMemoryThreshold = initialMemoryThreshold
@volatile private[this] var myMemoryThreshold = initialMemoryThreshold

// Number of elements read from input since last spill
private[this] var _elementsRead = 0L

// Number of bytes spilled in total
private[this] var _memoryBytesSpilled = 0L
@volatile private[this] var _memoryBytesSpilled = 0L

// Number of spills
private[this] var _spillCount = 0
Expand Down

0 comments on commit e009d95

Please sign in to comment.