From a814ac3d671880474ca35dd1934e8ea7a9a6f81b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 11 Nov 2008 20:33:29 +0000 Subject: [PATCH] * Put an Enabled switch on the async object deleter for future testing purposes --- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 14 +++++++++++--- OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ .../Region/Environment/Scenes/Tests/SceneTests.cs | 8 ++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs index ca28bbd909..706ba6a9de 100644 --- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -54,9 +54,14 @@ namespace OpenSim.Region.Environment.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Is the deleter currently enabled? + /// + public bool Enabled; + private Timer m_inventoryTicker = new Timer(2000); private readonly Queue m_inventoryDeletes = new Queue(); - private Scene m_scene; + private Scene m_scene; public AsyncSceneObjectGroupDeleter(Scene scene) { @@ -73,7 +78,8 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup objectGroup, IClientAPI remoteClient, bool permissionToDelete) { - m_inventoryTicker.Stop(); + if (Enabled) + m_inventoryTicker.Stop(); lock (m_inventoryDeletes) { @@ -87,7 +93,8 @@ namespace OpenSim.Region.Environment.Scenes m_inventoryDeletes.Enqueue(dtis); } - m_inventoryTicker.Start(); + if (Enabled) + m_inventoryTicker.Start(); // Visually remove it, even if it isnt really gone yet. if (permissionToDelete) @@ -132,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.DebugFormat("Exception background deleting object: "+e.ToString()); } } + return true; } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fd4eb58a35..326380b557 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -281,7 +281,9 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager = new EventManager(); m_externalChecks = new SceneExternalChecks(this); + m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); + m_asyncSceneObjectDeleter.Enabled = true; // Load region settings m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs index 35b633eae8..b603e304a8 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs @@ -106,5 +106,13 @@ namespace OpenSim.Region.Environment.Scenes.Tests // If the parts have the same UUID then we will consider them as one and the same Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); } + + /* + public void TestRemoveSceneObject() + { + Scene scene = SetupScene(); + SceneObjectPart part = AddSceneObject(scene); + } + */ } } \ No newline at end of file