From bceef401fa9f7b9d56c5d1173ca5204aead0a57c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 21 Sep 2012 01:36:23 +0100
Subject: Simplify UuidGatherer by performing asset fetch synchronously rather
than using the async call but waiting for completion anyway!
---
OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 84 +++++++++++++------------
1 file changed, 44 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index efb68a2..af99090 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -57,17 +57,17 @@ namespace OpenSim.Region.Framework.Scenes
/// Asset cache used for gathering assets
///
protected IAssetService m_assetCache;
-
- ///
- /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
- /// asset was found by the asset service.
- ///
- private AssetBase m_requestedObjectAsset;
- ///
- /// Signal whether we are currently waiting for the asset service to deliver an asset.
- ///
- private bool m_waitingForObjectAsset;
+// ///
+// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
+// /// asset was found by the asset service.
+// ///
+// private AssetBase m_requestedObjectAsset;
+//
+// ///
+// /// Signal whether we are currently waiting for the asset service to deliver an asset.
+// ///
+// private bool m_waitingForObjectAsset;
public UuidGatherer(IAssetService assetCache)
{
@@ -195,18 +195,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- ///
- /// The callback made when we request the asset for an object from the asset service.
- ///
- private void AssetReceived(string id, Object sender, AssetBase asset)
- {
- lock (this)
- {
- m_requestedObjectAsset = asset;
- m_waitingForObjectAsset = false;
- Monitor.Pulse(this);
- }
- }
+// ///
+// /// The callback made when we request the asset for an object from the asset service.
+// ///
+// private void AssetReceived(string id, Object sender, AssetBase asset)
+// {
+// lock (this)
+// {
+// m_requestedObjectAsset = asset;
+// m_waitingForObjectAsset = false;
+// Monitor.Pulse(this);
+// }
+// }
///
/// Get an asset synchronously, potentially using an asynchronous callback. If the
@@ -216,25 +216,29 @@ namespace OpenSim.Region.Framework.Scenes
///
protected virtual AssetBase GetAsset(UUID uuid)
{
- m_waitingForObjectAsset = true;
- m_assetCache.Get(uuid.ToString(), this, AssetReceived);
-
- // The asset cache callback can either
- //
- // 1. Complete on the same thread (if the asset is already in the cache) or
- // 2. Come in via a different thread (if we need to go fetch it).
- //
- // The code below handles both these alternatives.
- lock (this)
- {
- if (m_waitingForObjectAsset)
- {
- Monitor.Wait(this);
- m_waitingForObjectAsset = false;
- }
- }
+ return m_assetCache.Get(uuid.ToString());
- return m_requestedObjectAsset;
+ // XXX: Switching to do this synchronously where the call was async before but we always waited for it
+ // to complete anyway!
+// m_waitingForObjectAsset = true;
+// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
+//
+// // The asset cache callback can either
+// //
+// // 1. Complete on the same thread (if the asset is already in the cache) or
+// // 2. Come in via a different thread (if we need to go fetch it).
+// //
+// // The code below handles both these alternatives.
+// lock (this)
+// {
+// if (m_waitingForObjectAsset)
+// {
+// Monitor.Wait(this);
+// m_waitingForObjectAsset = false;
+// }
+// }
+//
+// return m_requestedObjectAsset;
}
///
--
cgit v1.1
From 632a42e2b1e9a649be812ed57de1189778a370c9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 21 Sep 2012 01:57:13 +0100
Subject: Rename UuidGather.m_assetCache to m_assetService. If HGUuidGatherer
hasn't been instantiated with an assetServerURL then call down to overriden
UuidGatherer.GetAsset() instead of calling m_assetService.GetAsset() itself -
these two codepaths are now identical.
---
OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index af99090..dc4a082 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -52,11 +52,8 @@ namespace OpenSim.Region.Framework.Scenes
public class UuidGatherer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- ///
- /// Asset cache used for gathering assets
- ///
- protected IAssetService m_assetCache;
+
+ protected IAssetService m_assetService;
// ///
// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
@@ -71,7 +68,7 @@ namespace OpenSim.Region.Framework.Scenes
public UuidGatherer(IAssetService assetCache)
{
- m_assetCache = assetCache;
+ m_assetService = assetCache;
}
///
@@ -216,7 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
///
protected virtual AssetBase GetAsset(UUID uuid)
{
- return m_assetCache.Get(uuid.ToString());
+ return m_assetService.Get(uuid.ToString());
// XXX: Switching to do this synchronously where the call was async before but we always waited for it
// to complete anyway!
--
cgit v1.1