aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-04-14 17:15:09 +0000
committerJustin Clarke Casey2009-04-14 17:15:09 +0000
commit1894157dd3608a15c3336efc2d58eee0de092610 (patch)
treecfecb8e2104d9a88e82670e27ecedbda0466fa88 /OpenSim/Framework/Communications/Cache
parent* refactor: rename AssetCache.Initialize() to AssetCache.Reset() to avoid hav... (diff)
downloadopensim-SC_OLD-1894157dd3608a15c3336efc2d58eee0de092610.zip
opensim-SC_OLD-1894157dd3608a15c3336efc2d58eee0de092610.tar.gz
opensim-SC_OLD-1894157dd3608a15c3336efc2d58eee0de092610.tar.bz2
opensim-SC_OLD-1894157dd3608a15c3336efc2d58eee0de092610.tar.xz
* Explicitly start the asset server thread so that unit tests can run single rather than multi-threaded (which may be behind the occasional test freezes)
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs39
-rw-r--r--OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs5
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs5
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs5
4 files changed, 19 insertions, 35 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 1d0c030..343667a 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications.Cache
42 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 protected IAssetReceiver m_receiver; 44 protected IAssetReceiver m_receiver;
45 protected BlockingQueue<AssetRequest> m_assetRequests; 45 protected BlockingQueue<AssetRequest> m_assetRequests = new BlockingQueue<AssetRequest>();
46 protected Thread m_localAssetServerThread; 46 protected Thread m_localAssetServerThread;
47 protected IAssetDataPlugin m_assetProvider; 47 protected IAssetDataPlugin m_assetProvider;
48 48
@@ -109,6 +109,22 @@ namespace OpenSim.Framework.Communications.Cache
109 // Temporarily hardcoded - should be a plugin 109 // Temporarily hardcoded - should be a plugin
110 protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); 110 protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
111 111
112 public virtual void Start()
113 {
114 m_log.Debug("[ASSET SERVER]: Starting asset server");
115
116 m_localAssetServerThread = new Thread(RunRequests);
117 m_localAssetServerThread.Name = "LocalAssetServerThread";
118 m_localAssetServerThread.IsBackground = true;
119 m_localAssetServerThread.Start();
120 ThreadTracker.Add(m_localAssetServerThread);
121 }
122
123 public virtual void Stop()
124 {
125 m_localAssetServerThread.Abort();
126 }
127
112 public abstract void StoreAsset(AssetBase asset); 128 public abstract void StoreAsset(AssetBase asset);
113 129
114 /// <summary> 130 /// <summary>
@@ -121,8 +137,8 @@ namespace OpenSim.Framework.Communications.Cache
121 /// Thrown if the request failed for some other reason than that the 137 /// Thrown if the request failed for some other reason than that the
122 /// asset cannot be found. 138 /// asset cannot be found.
123 /// </exception> 139 /// </exception>
124 protected abstract AssetBase GetAsset(AssetRequest req); 140 protected abstract AssetBase GetAsset(AssetRequest req);
125 141
126 /// <summary> 142 /// <summary>
127 /// Process an asset request. This method will call GetAsset(AssetRequest req) 143 /// Process an asset request. This method will call GetAsset(AssetRequest req)
128 /// on the subclass. 144 /// on the subclass.
@@ -169,18 +185,6 @@ namespace OpenSim.Framework.Communications.Cache
169 assetLoader.ForEachDefaultXmlAsset(pAssetSetsXml, StoreAsset); 185 assetLoader.ForEachDefaultXmlAsset(pAssetSetsXml, StoreAsset);
170 } 186 }
171 187
172 public AssetServerBase()
173 {
174 m_log.Info("[ASSET SERVER]: Starting asset storage system");
175 m_assetRequests = new BlockingQueue<AssetRequest>();
176
177 m_localAssetServerThread = new Thread(RunRequests);
178 m_localAssetServerThread.Name = "LocalAssetServerThread";
179 m_localAssetServerThread.IsBackground = true;
180 m_localAssetServerThread.Start();
181 ThreadTracker.Add(m_localAssetServerThread);
182 }
183
184 private void RunRequests() 188 private void RunRequests()
185 { 189 {
186 while (true) // Since it's a 'blocking queue' 190 while (true) // Since it's a 'blocking queue'
@@ -222,11 +226,6 @@ namespace OpenSim.Framework.Communications.Cache
222 m_assetProvider.UpdateAsset(asset); 226 m_assetProvider.UpdateAsset(asset);
223 } 227 }
224 228
225 public virtual void Close()
226 {
227 m_localAssetServerThread.Abort();
228 }
229
230 public void SetServerInfo(string ServerUrl, string ServerKey) 229 public void SetServerInfo(string ServerUrl, string ServerKey)
231 { 230 {
232 } 231 }
diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
index f1c19fa..6e4dd1c 100644
--- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
@@ -554,11 +554,6 @@ namespace OpenSim.Framework.Communications.Cache
554 } 554 }
555 } 555 }
556 556
557 public override void Close()
558 {
559 throw new Exception("The method or operation is not implemented.");
560 }
561
562 #endregion 557 #endregion
563 } 558 }
564} 559}
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index 7131cb5..c7d4c99 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -135,11 +135,6 @@ namespace OpenSim.Framework.Communications.Cache
135 } 135 }
136 } 136 }
137 137
138 public override void Close()
139 {
140 throw new Exception("The method or operation is not implemented.");
141 }
142
143 #endregion 138 #endregion
144 } 139 }
145} 140}
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 41a9561..227744d 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -100,11 +100,6 @@ namespace OpenSim.Framework.Communications.Cache
100 } 100 }
101 } 101 }
102 102
103 public override void Close()
104 {
105 base.Close();
106 }
107
108 protected override AssetBase GetAsset(AssetRequest req) 103 protected override AssetBase GetAsset(AssetRequest req)
109 { 104 {
110 return m_assetProvider.FetchAsset(req.AssetID); 105 return m_assetProvider.FetchAsset(req.AssetID);