Skip to content

Instantly share code, notes, and snippets.

/post.scala
Created Jul 20, 2017

Embed
What would you like to do?
the description for this gist
class WorkItem(value: String)
class WorkProducer(numItemsToProduce:Int,
queue: BoundedTaskQueue,
terminationLatch:CountDownLatch) extends Runnable {
val r = new Random()
override def run(): Unit = {
for {_ <- 1 to numItemsToProduce} {
queue.add(new WorkItem(r.nextString(5)))
}
terminationLatch.countDown()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.