2

I have a task in which I have to read data using different threads.

The problem is that due to the limitation of read rates, I built different threads with thread groups.

Now can any one tell me how to sleep one entire thread group so that it begins execution from exact same place where it left and the other thread groups remain executing?

Jivings
  • 22,834
  • 6
  • 60
  • 101
ADARSH
  • 31
  • 5
  • 3
    From what are you reading? An `InputStream`? Your question is very unclear. It sounds like you have one thread for each stream, but if that were the case, it would just block automatically while waiting for data and resume automatically when data became available, making your question moot. – erickson Jan 28 '12 at 15:56
  • The question isn't clear enough to be certain, but the solution may be to suspend threads using the debug API. – biziclop Jan 29 '12 at 20:09
  • Do you want to sleep for a time period? – Jivings Feb 04 '12 at 10:28

1 Answers1

0

Without having more details it sounds like you might need to look into using a CyclicBarrier or a CountDownLatch. They won't operate at the ThreadGroup level but may provide the common wait point you are looking for.

wort
  • 136
  • 4