From 80eecd2cb14fa0c8017693241fa903bd09f46597 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 28 Feb 2013 10:41:07 -0600 Subject: [PATCH] Make Executor fields volatile since they're read from the thread pool. --- core/src/main/scala/spark/executor/Executor.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/scala/spark/executor/Executor.scala b/core/src/main/scala/spark/executor/Executor.scala index 5de09030aa..663dec2615 100644 --- a/core/src/main/scala/spark/executor/Executor.scala +++ b/core/src/main/scala/spark/executor/Executor.scala @@ -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()