}
private void fireChangedAgentState(AID agentID, AgentState from, AgentState to) {
// NOTE: A normal synchronized block could create deadlock problems
// as it prevents concurrent scannings of the listeners list.
List l = agentListeners.startScanning();
if (l != null) {
AgentEvent ev = new AgentEvent(AgentEvent.CHANGED_AGENT_STATE, agentID, from, to, myID());
Iterator it = l.iterator();
while (it.hasNext()) {
AgentListener al = (AgentListener) it.next();
al.changedAgentState(ev);
}
agentListeners.stopScanning();