public void setAgentIdle ( int agentId , boolean idle ) { // If agent is becoming active, and not already active if ( ! idle /* && !activeAgents.contains(agentId) */ ) { synchronized ( extToAdd ) { extToAdd . add ( agentId ) ; } } // If agent is becoming idle, and not already idle if ( idle /* && activeAgents.contains(agentId) */ ) { synchronized ( extToRemove ) { extToRemove . add ( agentId ) ; } } }
and this thread is still iterating over activeagents