Starting a thread via html
Okay, to make it simple I'm gonna analogize everything...
Suppose we have a bag of marbles, each marble has a number on it, it can be any integer, and the bag will always be missing some numbers.
The program will have 3 states (In the Bag, Above the Bag, Below the Bag)
I have an applet that will handle what happens when they are in the states, the user handles what happens to the marbles by a link outside of the applet.
Now my question: If what happens to each marble is controlled by a thread, how do I execute the command to it, so far my application successfully receives the commands from the browser when the user clicks the link...
Should I use a global variable? Then if it matches the integer perform the duty, seems like I would need another thread? as well as an infinite loop. And if it is an infinite loop I would have to put thread.sleep on it, that would keep the cpu low... right? Also if I do that, what are the odds that my application would miss the execute command because it happens while the user clicks two links within a thread sleep timeout.
Any ideas would be appreciated, what would you do?

