aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetServerBase.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs39
1 files changed, 19 insertions, 20 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 }