aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/UuidGatherer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs93
1 files changed, 47 insertions, 46 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index efb68a2..dc4a082 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -52,26 +52,23 @@ namespace OpenSim.Region.Framework.Scenes
52 public class UuidGatherer 52 public class UuidGatherer
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 /// <summary>
57 /// Asset cache used for gathering assets
58 /// </summary>
59 protected IAssetService m_assetCache;
60
61 /// <summary>
62 /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
63 /// asset was found by the asset service.
64 /// </summary>
65 private AssetBase m_requestedObjectAsset;
66 55
67 /// <summary> 56 protected IAssetService m_assetService;
68 /// Signal whether we are currently waiting for the asset service to deliver an asset. 57
69 /// </summary> 58// /// <summary>
70 private bool m_waitingForObjectAsset; 59// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
60// /// asset was found by the asset service.
61// /// </summary>
62// private AssetBase m_requestedObjectAsset;
63//
64// /// <summary>
65// /// Signal whether we are currently waiting for the asset service to deliver an asset.
66// /// </summary>
67// private bool m_waitingForObjectAsset;
71 68
72 public UuidGatherer(IAssetService assetCache) 69 public UuidGatherer(IAssetService assetCache)
73 { 70 {
74 m_assetCache = assetCache; 71 m_assetService = assetCache;
75 } 72 }
76 73
77 /// <summary> 74 /// <summary>
@@ -195,18 +192,18 @@ namespace OpenSim.Region.Framework.Scenes
195 } 192 }
196 } 193 }
197 194
198 /// <summary> 195// /// <summary>
199 /// The callback made when we request the asset for an object from the asset service. 196// /// The callback made when we request the asset for an object from the asset service.
200 /// </summary> 197// /// </summary>
201 private void AssetReceived(string id, Object sender, AssetBase asset) 198// private void AssetReceived(string id, Object sender, AssetBase asset)
202 { 199// {
203 lock (this) 200// lock (this)
204 { 201// {
205 m_requestedObjectAsset = asset; 202// m_requestedObjectAsset = asset;
206 m_waitingForObjectAsset = false; 203// m_waitingForObjectAsset = false;
207 Monitor.Pulse(this); 204// Monitor.Pulse(this);
208 } 205// }
209 } 206// }
210 207
211 /// <summary> 208 /// <summary>
212 /// Get an asset synchronously, potentially using an asynchronous callback. If the 209 /// Get an asset synchronously, potentially using an asynchronous callback. If the
@@ -216,25 +213,29 @@ namespace OpenSim.Region.Framework.Scenes
216 /// <returns></returns> 213 /// <returns></returns>
217 protected virtual AssetBase GetAsset(UUID uuid) 214 protected virtual AssetBase GetAsset(UUID uuid)
218 { 215 {
219 m_waitingForObjectAsset = true; 216 return m_assetService.Get(uuid.ToString());
220 m_assetCache.Get(uuid.ToString(), this, AssetReceived);
221
222 // The asset cache callback can either
223 //
224 // 1. Complete on the same thread (if the asset is already in the cache) or
225 // 2. Come in via a different thread (if we need to go fetch it).
226 //
227 // The code below handles both these alternatives.
228 lock (this)
229 {
230 if (m_waitingForObjectAsset)
231 {
232 Monitor.Wait(this);
233 m_waitingForObjectAsset = false;
234 }
235 }
236 217
237 return m_requestedObjectAsset; 218 // XXX: Switching to do this synchronously where the call was async before but we always waited for it
219 // to complete anyway!
220// m_waitingForObjectAsset = true;
221// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
222//
223// // The asset cache callback can either
224// //
225// // 1. Complete on the same thread (if the asset is already in the cache) or
226// // 2. Come in via a different thread (if we need to go fetch it).
227// //
228// // The code below handles both these alternatives.
229// lock (this)
230// {
231// if (m_waitingForObjectAsset)
232// {
233// Monitor.Wait(this);
234// m_waitingForObjectAsset = false;
235// }
236// }
237//
238// return m_requestedObjectAsset;
238 } 239 }
239 240
240 /// <summary> 241 /// <summary>