Make Executor fields volatile since they're read from the thread pool.

This commit is contained in:
Stephen Haberman 2013-02-28 10:41:07 -06:00
parent d6e6abece3
commit 80eecd2cb1

View file

@ -17,16 +17,16 @@ import java.nio.ByteBuffer
* The Mesos executor for Spark.
*/
private[spark] class Executor extends Logging {
var urlClassLoader : ExecutorURLClassLoader = null
var threadPool: ExecutorService = null
var env: SparkEnv = null
@volatile private var urlClassLoader : ExecutorURLClassLoader = null
@volatile private var threadPool: ExecutorService = null
@volatile private var env: SparkEnv = null
// Application dependencies (added through SparkContext) that we've fetched so far on this node.
// Each map holds the master's timestamp for the version of that file or JAR we got.
val currentFiles: HashMap[String, Long] = new HashMap[String, Long]()
val currentJars: HashMap[String, Long] = new HashMap[String, Long]()
private val currentFiles: HashMap[String, Long] = new HashMap[String, Long]()
private val currentJars: HashMap[String, Long] = new HashMap[String, Long]()
val EMPTY_BYTE_BUFFER = ByteBuffer.wrap(new Array[Byte](0))
private val EMPTY_BYTE_BUFFER = ByteBuffer.wrap(new Array[Byte](0))
initLogging()