From 2ffd7424384fc7dee594b00528e8991622ffbb45 Mon Sep 17 00:00:00 2001 From: Li Zhihui Date: Mon, 4 Aug 2014 17:29:06 +0800 Subject: [PATCH] add comment for FileLock --- core/src/main/scala/org/apache/spark/util/Utils.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala index 67e5636689f57..5105bede24c35 100644 --- a/core/src/main/scala/org/apache/spark/util/Utils.scala +++ b/core/src/main/scala/org/apache/spark/util/Utils.scala @@ -324,7 +324,10 @@ private[spark] object Utils extends Logging { val localDir = new File(getLocalDir(conf)) val lockFile = new File(localDir, lockFileName) val raf = new RandomAccessFile(lockFile, "rw") - val lock = raf.getChannel().lock() // only one executor entry + // Only one executor entry. + // The FileLock is only used to control synchronization for executors download file, + // it's always safe regardless of lock type(mandatory or advisory). + val lock = raf.getChannel().lock() val cachedFile = new File(localDir, cachedFileName) try { if (!cachedFile.exists()) {