Created
March 13, 2011 15:23
-
-
Save rares/868171 to your computer and use it in GitHub Desktop.
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
import java.util.concurrent.ArrayBlockingQueue | |
class Worker extends Runnable { | |
private val queue = new ArrayBlockingQueue[String](10) | |
def pushWork(s: String) = queue.put(s) | |
def run { | |
while(true) { | |
for { job <- Option(queue.poll) } yield { println(job) } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment