added in find calls

added logging of exceptions, which we'll get quite a few of at this
point most likely
0.6.0-stable
Sean Dague 2008-09-04 22:06:16 +00:00
parent 6e1bcbcf48
commit a0f2e46836
1 changed files with 52 additions and 2 deletions

View File

@ -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;
}
}
}
}