Non Blocking Java Thread help
Posted on 2010-09-22
I am having trouble understanding how to complete my task.
I have a class that starts a thread that contains a queue of actions. When the thread processes these actions there will be times that the given action requires additional input from the class that started the thread. What I cannot figure out is how I do the following:
Class A starts Thread T
T starts and begins to process action queue
T comes across an action that requires additional input from A
T pauses waiting for A to post additional info
A Posts info to T
T sees post and continues processing action queue with additional info.
What I cannot figure out is how to make T pause, non-blocking, waiting for A to post. Then A invokes a method within T to post the additional info and continue on. Basically I need to create some type of non-blocking loop so that methods within T can still be called by A but T waits to process the queue until A post more info.
Hope you can help!!!!