aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/scala/org/apache/spark/Smuggle.scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/scala/org/apache/spark/Smuggle.scala')
-rw-r--r--core/src/test/scala/org/apache/spark/Smuggle.scala46
1 files changed, 23 insertions, 23 deletions
diff --git a/core/src/test/scala/org/apache/spark/Smuggle.scala b/core/src/test/scala/org/apache/spark/Smuggle.scala
index 9f0a1b4c25..9d9217ea1b 100644
--- a/core/src/test/scala/org/apache/spark/Smuggle.scala
+++ b/core/src/test/scala/org/apache/spark/Smuggle.scala
@@ -24,16 +24,16 @@ import scala.collection.mutable
import scala.language.implicitConversions
/**
- * Utility wrapper to "smuggle" objects into tasks while bypassing serialization.
- * This is intended for testing purposes, primarily to make locks, semaphores, and
- * other constructs that would not survive serialization available from within tasks.
- * A Smuggle reference is itself serializable, but after being serialized and
- * deserialized, it still refers to the same underlying "smuggled" object, as long
- * as it was deserialized within the same JVM. This can be useful for tests that
- * depend on the timing of task completion to be deterministic, since one can "smuggle"
- * a lock or semaphore into the task, and then the task can block until the test gives
- * the go-ahead to proceed via the lock.
- */
+ * Utility wrapper to "smuggle" objects into tasks while bypassing serialization.
+ * This is intended for testing purposes, primarily to make locks, semaphores, and
+ * other constructs that would not survive serialization available from within tasks.
+ * A Smuggle reference is itself serializable, but after being serialized and
+ * deserialized, it still refers to the same underlying "smuggled" object, as long
+ * as it was deserialized within the same JVM. This can be useful for tests that
+ * depend on the timing of task completion to be deterministic, since one can "smuggle"
+ * a lock or semaphore into the task, and then the task can block until the test gives
+ * the go-ahead to proceed via the lock.
+ */
class Smuggle[T] private(val key: Symbol) extends Serializable {
def smuggledObject: T = Smuggle.get(key)
}
@@ -41,13 +41,13 @@ class Smuggle[T] private(val key: Symbol) extends Serializable {
object Smuggle {
/**
- * Wraps the specified object to be smuggled into a serialized task without
- * being serialized itself.
- *
- * @param smuggledObject
- * @tparam T
- * @return Smuggle wrapper around smuggledObject.
- */
+ * Wraps the specified object to be smuggled into a serialized task without
+ * being serialized itself.
+ *
+ * @param smuggledObject
+ * @tparam T
+ * @return Smuggle wrapper around smuggledObject.
+ */
def apply[T](smuggledObject: T): Smuggle[T] = {
val key = Symbol(UUID.randomUUID().toString)
lock.writeLock().lock()
@@ -72,12 +72,12 @@ object Smuggle {
}
/**
- * Implicit conversion of a Smuggle wrapper to the object being smuggled.
- *
- * @param smuggle the wrapper to unpack.
- * @tparam T
- * @return the smuggled object represented by the wrapper.
- */
+ * Implicit conversion of a Smuggle wrapper to the object being smuggled.
+ *
+ * @param smuggle the wrapper to unpack.
+ * @tparam T
+ * @return the smuggled object represented by the wrapper.
+ */
implicit def unpackSmuggledObject[T](smuggle : Smuggle[T]): T = smuggle.smuggledObject
}