0

I am importing a large amount of data from files to a Redis database. So I have two steps to perform: parsing the files, then importing them using jedis.

I want to parse and import at the same times using one thread for each task to speed up the process.

What would be a good approach to exchange the data between those two threads? I suppose I need some kind of lightweight Java message queue.

Would Java Message Service be a good solution? Or could I just use a concurrent Java List?

MasterScrat
  • 7,090
  • 14
  • 48
  • 80
  • Have you looked at [BlockingQueue](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html) or [ConcurrentLinkedQueue](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html)? I wouldn't bother with a messaging service if you're working with threads and not separate processes. – DaoWen Mar 22 '14 at 22:58

1 Answers1

1

As @DaoWen said, since you are using threads you don't have to bother with an MQ. BlockingQueue and ConcurrentLinkedQueue should be fine.

FGRibreau
  • 7,021
  • 2
  • 39
  • 48