* 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)
parent
ad2bd74057
commit
1894157dd3
|
@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected IAssetReceiver m_receiver;
|
||||
protected BlockingQueue<AssetRequest> m_assetRequests;
|
||||
protected BlockingQueue<AssetRequest> m_assetRequests = new BlockingQueue<AssetRequest>();
|
||||
protected Thread m_localAssetServerThread;
|
||||
protected IAssetDataPlugin m_assetProvider;
|
||||
|
||||
|
@ -109,6 +109,22 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
// Temporarily hardcoded - should be a plugin
|
||||
protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
m_log.Debug("[ASSET SERVER]: Starting asset server");
|
||||
|
||||
m_localAssetServerThread = new Thread(RunRequests);
|
||||
m_localAssetServerThread.Name = "LocalAssetServerThread";
|
||||
m_localAssetServerThread.IsBackground = true;
|
||||
m_localAssetServerThread.Start();
|
||||
ThreadTracker.Add(m_localAssetServerThread);
|
||||
}
|
||||
|
||||
public virtual void Stop()
|
||||
{
|
||||
m_localAssetServerThread.Abort();
|
||||
}
|
||||
|
||||
public abstract void StoreAsset(AssetBase asset);
|
||||
|
||||
/// <summary>
|
||||
|
@ -169,18 +185,6 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
assetLoader.ForEachDefaultXmlAsset(pAssetSetsXml, StoreAsset);
|
||||
}
|
||||
|
||||
public AssetServerBase()
|
||||
{
|
||||
m_log.Info("[ASSET SERVER]: Starting asset storage system");
|
||||
m_assetRequests = new BlockingQueue<AssetRequest>();
|
||||
|
||||
m_localAssetServerThread = new Thread(RunRequests);
|
||||
m_localAssetServerThread.Name = "LocalAssetServerThread";
|
||||
m_localAssetServerThread.IsBackground = true;
|
||||
m_localAssetServerThread.Start();
|
||||
ThreadTracker.Add(m_localAssetServerThread);
|
||||
}
|
||||
|
||||
private void RunRequests()
|
||||
{
|
||||
while (true) // Since it's a 'blocking queue'
|
||||
|
@ -222,11 +226,6 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
m_assetProvider.UpdateAsset(asset);
|
||||
}
|
||||
|
||||
public virtual void Close()
|
||||
{
|
||||
m_localAssetServerThread.Abort();
|
||||
}
|
||||
|
||||
public void SetServerInfo(string ServerUrl, string ServerKey)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -554,11 +554,6 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,11 +135,6 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,11 +100,6 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
base.Close();
|
||||
}
|
||||
|
||||
protected override AssetBase GetAsset(AssetRequest req)
|
||||
{
|
||||
return m_assetProvider.FetchAsset(req.AssetID);
|
||||
|
|
|
@ -62,7 +62,9 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
TestAssetDataPlugin assetPlugin = new TestAssetDataPlugin();
|
||||
assetPlugin.CreateAsset(asset);
|
||||
|
||||
IAssetCache assetCache = new AssetCache(new SQLAssetServer(assetPlugin));
|
||||
IAssetServer assetServer = new SQLAssetServer(assetPlugin);
|
||||
IAssetCache assetCache = new AssetCache(assetServer);
|
||||
assetServer.Start();
|
||||
|
||||
lock (this)
|
||||
{
|
||||
|
|
|
@ -37,11 +37,21 @@ namespace OpenSim.Framework
|
|||
void Initialise(ConfigSettings settings);
|
||||
void Initialise(ConfigSettings settings, string url, string dir, bool test);
|
||||
void Initialise(ConfigSettings settings, string url);
|
||||
|
||||
/// <summary>
|
||||
/// Start the asset server
|
||||
/// </summary>
|
||||
void Start();
|
||||
|
||||
/// <summary>
|
||||
/// Stop the asset server
|
||||
/// </summary>
|
||||
void Stop();
|
||||
|
||||
void SetReceiver(IAssetReceiver receiver);
|
||||
void RequestAsset(UUID assetID, bool isTexture);
|
||||
void StoreAsset(AssetBase asset);
|
||||
void UpdateAsset(AssetBase asset);
|
||||
void Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -381,6 +381,8 @@ namespace OpenSim
|
|||
// Initialize the asset cache, passing a reference to the selected
|
||||
// asset server interface.
|
||||
m_assetCache = ResolveAssetCache(assetServer);
|
||||
|
||||
assetServer.Start();
|
||||
}
|
||||
|
||||
// This method loads the identified asset server, passing an approrpiately
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
|
||||
SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin());
|
||||
m_assetCache = new AssetCache(assetService);
|
||||
m_assetCache.AssetServer.Start();
|
||||
|
||||
LocalInventoryService lis = new LocalInventoryService();
|
||||
lis.AddPlugin(m_inventoryDataPlugin);
|
||||
|
|
Loading…
Reference in New Issue