Package org.apache.spark.util
Class SparkThreadUtils
Object
org.apache.spark.util.SparkThreadUtils
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> TawaitResult(scala.concurrent.Awaitable<T> awaitable, scala.concurrent.duration.Duration atMost) Preferred alternative toAwait.result().static <T> TawaitResultNoSparkExceptionConversion(scala.concurrent.Awaitable<T> awaitable, scala.concurrent.duration.Duration atMost) 
- 
Constructor Details- 
SparkThreadUtilspublic SparkThreadUtils()
 
- 
- 
Method Details- 
awaitResultpublic static <T> T awaitResult(scala.concurrent.Awaitable<T> awaitable, scala.concurrent.duration.Duration atMost) throws SparkException Preferred alternative toAwait.result().This method wraps and re-throws any exceptions thrown by the underlying Awaitcall, ensuring that this thread's stack trace appears in logs.In addition, it calls Awaitable.resultdirectly to avoid usingForkJoinPool'sBlockingContext. Codes running in the user's thread may be in a thread of Scala ForkJoinPool. As concurrent executions in ForkJoinPool may see someThreadLocalvalue unexpectedly, this method basically prevents ForkJoinPool from running other tasks in the current waiting thread. In general, we should use this method because many places in Spark useThreadLocaland it's hard to debug whenThreadLocals leak to other tasks.- Parameters:
- awaitable- (undocumented)
- atMost- (undocumented)
- Returns:
- (undocumented)
- Throws:
- SparkException
 
- 
awaitResultNoSparkExceptionConversionpublic static <T> T awaitResultNoSparkExceptionConversion(scala.concurrent.Awaitable<T> awaitable, scala.concurrent.duration.Duration atMost) 
 
-