Open Wouter1 opened 10 years ago
We discussed this, the proposal is to not keep shadow copies. If the hashmap is preferable (eg for performance reasons?), fix EIDefaultImpl and do not make shadow copies.
Added @Override to EIDefaultImpl functions that actually override, to clarify what is really implementation of EnvironmentInterfaceStandard.
It's not so easy to fix this in a clean way, I considered copying the code but EIDefaultImp is too large (1255 lines). See also http://ii.tudelft.nl/trac/goal/ticket/3341
AbstractEnvironment extends EIDefaultImpl.
Therefore it inherits the freePair(agent,entity) function
freePair removes its references to the entity (from LinkedList? entities and ConcurrentHashMap<String, HashSet> agentsToEntities)
(BTW interesting but useless attempt here at making EIDefaultImpl thread safe by using ConcurrentHashMap??)
However AbstractEnvironment maintains its own copy of the existing entities: Map<String, Object> entities.
Because AbstractEnvironment never updates its copy when freePair is called, this results in an inconsistent state in AbstractEnvironment. For example, AbstractEnvironment#getEntity will still return the non-removed entity.