public class main { main() { for loop { new bot(this); } } botdone(stuff) { do things with stuff } } public class bot implements Runnable { boolean done; private Thread t; main theMain; bot(main startingMain) { theMain = startingMain; //set up boring stuff. } public start() { done = false; t = new Thread(this); t.start(); } public stop() { done = true; } public boolean isRunning() { return !done; } public run() { while (!done) { // do stuff } theMain.botDone(my stuff) }