Consider using BlockingQueue or other Java producer/consumer implementation