aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/scala/spark/util/IdGenerator.scala
blob: b6e309fe1ae68f7c06361dc12f0edbce5f5c3f9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package spark.util

import java.util.concurrent.atomic.AtomicInteger

/**
 * A util used to get a unique generation ID. This is a wrapper around Java's
 * AtomicInteger. An example usage is in BlockManager, where each BlockManager
 * instance would start an Akka actor and we use this utility to assign the Akka
 * actors unique names.
 */
private[spark] class IdGenerator {
  private var id = new AtomicInteger
  def next: Int = id.incrementAndGet
}