diff --git a/OpenSim/Region/Environment/Scenes/EntityList.cs b/OpenSim/Region/Environment/Scenes/EntityList.cs index c64e549151..a03b36cb15 100644 --- a/OpenSim/Region/Environment/Scenes/EntityList.cs +++ b/OpenSim/Region/Environment/Scenes/EntityList.cs @@ -41,11 +41,17 @@ namespace OpenSim.Region.Environment.Scenes { public class EntityList { - + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + // we are intentionally using non generics here as testing has + // shown synchronized collections are faster than manually + // locked generics. + private Hashtable m_obj_by_uuid; - private Hashtable m_pres_by_uuid; private Hashtable m_obj_by_local; + private Hashtable m_pres_by_uuid; + public EntityList() { m_obj_by_uuid = Hashtable.Synchronized(new Hashtable()); @@ -89,6 +95,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { + m_log.ErrorFormat("RemoveObject failed for {0}", uuid, e); sog = null; } return sog; @@ -104,9 +111,52 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { + m_log.ErrorFormat("RemovePresence failed for {0}", uuid, e); sp = null; } return sp; } + + public SceneObjectGroup FindObject(LLUUID uuid) + { + try + { + SceneObjectGroup sog = (SceneObjectGroup)m_obj_by_uuid[uuid]; + return sog; + } + catch (Exception e) + { + m_log.ErrorFormat("FindObject failed for {0}", uuid, e); + return null; + } + } + + public SceneObjectGroup FindObject(int local) + { + try + { + LLUUID uuid = (LLUUID)m_obj_by_local[local]; + SceneObjectGroup sog = (SceneObjectGroup)m_obj_by_uuid[uuid]; + return sog; + } + catch (Exception e) + { + m_log.ErrorFormat("FindObject failed for {0}", local, e); + return null; + } + } + + public ScenePresence FindPresense(LLUUID uuid) + { + try + { + ScenePresence sp = (ScenePresence)m_pres_by_uuid[uuid]; + return sp; + } + catch (Exception e) + { + return null; + } + } } } \ No newline at end of file