Created
July 20, 2017 06:42
-
-
Save anonymous/1c65a73919e19d6a6f6f00ad766bef31 to your computer and use it in GitHub Desktop.
the description for this gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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