/** Start agent scheduler thread. Should be called once at init time. */ public synchronized void startThread() { if (agentThread == null) { agentThread = new AgentThread(getName()); agentThread.start(); // causes the run method to execute in the AgentThread below } else { agentThread.interrupt(); // don't worry about this for now } }
// In this implementation, nothing calls stopThread(). // When we have a user interface to agents, this can be called. public void stopThread() { if (agentThread != null) { agentThread.stopAgent(); agentThread = null; } }