mridulm commented on a change in pull request #34632:
URL: https://github.com/apache/spark/pull/34632#discussion_r752476094
##########
File path: core/src/main/scala/org/apache/spark/storage/BlockInfoManager.scala
##########
@@ -166,6 +189,48 @@ private[storage] class BlockInfoManager extends Logging {
Option(TaskContext.get()).map(_.taskAttemptId()).getOrElse(BlockInfo.NON_TASK_WRITER)
}
+ /**
+ * Helper for lock acquisistion.
+ */
+ private def acquireLock(
+ blockId: BlockId,
+ blocking: Boolean)(
+ f: BlockInfo => Boolean): Option[BlockInfo] = {
+ var done = false
+ var result: Option[BlockInfo] = None
+ while(!done) {
+ val wrapper = blockInfoWrappers.get(blockId)
+ if (wrapper == null) {
+ done = true
+ } else {
+ wrapper.withLock { (info, condition) =>
+ if (f(info)) {
+ result = Some(info)
+ done = true
+ } else if (!blocking) {
+ done = true
+ } else {
+ condition.await()
Review comment:
You are right, `acquireLock` gets used only where we previous had a
`wait`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]