diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetCache.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 80 |
1 files changed, 65 insertions, 15 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 1c8f9d6..76c6045 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -48,8 +48,67 @@ namespace OpenSim.Framework.Communications.Cache | |||
48 | /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and | 48 | /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and |
49 | /// AssetNotFound(), which means they do share the same asset and texture caches.I agr | 49 | /// AssetNotFound(), which means they do share the same asset and texture caches.I agr |
50 | 50 | ||
51 | public class AssetCache : IAssetCache, IAssetReceiver | 51 | public class AssetCache : IAssetCache |
52 | { | 52 | { |
53 | |||
54 | #region IPlugin | ||
55 | |||
56 | /// <summary> | ||
57 | /// The methods and properties in this section are needed to | ||
58 | /// support the IPlugin interface. They cann all be overridden | ||
59 | /// as needed by a derived class. | ||
60 | /// </summary> | ||
61 | |||
62 | public virtual string Name | ||
63 | { | ||
64 | get { return "OpenSim.Framework.Communications.Cache.AssetCache"; } | ||
65 | } | ||
66 | |||
67 | public virtual string Version | ||
68 | { | ||
69 | get { return "1.0"; } | ||
70 | } | ||
71 | |||
72 | public virtual void Initialise() | ||
73 | { | ||
74 | m_log.Debug("[ASSET CACHE]: Asset cache null initialisation"); | ||
75 | } | ||
76 | |||
77 | public virtual void Initialise(IAssetServer assetServer) | ||
78 | { | ||
79 | m_log.Debug("[ASSET CACHE]: Asset cache server-specified initialisation"); | ||
80 | m_log.InfoFormat("[ASSET CACHE]: Asset cache initialisation [{0}/{1}]", Name, Version); | ||
81 | |||
82 | Initialize(); | ||
83 | |||
84 | m_assetServer = assetServer; | ||
85 | m_assetServer.SetReceiver(this); | ||
86 | |||
87 | Thread assetCacheThread = new Thread(RunAssetManager); | ||
88 | assetCacheThread.Name = "AssetCacheThread"; | ||
89 | assetCacheThread.IsBackground = true; | ||
90 | assetCacheThread.Start(); | ||
91 | ThreadTracker.Add(assetCacheThread); | ||
92 | |||
93 | } | ||
94 | |||
95 | public virtual void Initialise(ConfigSettings settings, IAssetServer assetServer) | ||
96 | { | ||
97 | m_log.Debug("[ASSET CACHE]: Asset cache configured initialisation"); | ||
98 | Initialise(assetServer); | ||
99 | } | ||
100 | |||
101 | public AssetCache() | ||
102 | { | ||
103 | m_log.Debug("[ASSET CACHE]: Asset cache (plugin constructor)"); | ||
104 | } | ||
105 | |||
106 | public void Dispose() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | #endregion | ||
111 | |||
53 | protected ICache m_memcache = new SimpleMemoryCache(); | 112 | protected ICache m_memcache = new SimpleMemoryCache(); |
54 | 113 | ||
55 | private static readonly ILog m_log | 114 | private static readonly ILog m_log |
@@ -83,7 +142,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
83 | /// <summary> | 142 | /// <summary> |
84 | /// The 'server' from which assets can be requested and to which assets are persisted. | 143 | /// The 'server' from which assets can be requested and to which assets are persisted. |
85 | /// </summary> | 144 | /// </summary> |
86 | private readonly IAssetServer m_assetServer; | 145 | private IAssetServer m_assetServer; |
87 | 146 | ||
88 | public IAssetServer AssetServer | 147 | public IAssetServer AssetServer |
89 | { | 148 | { |
@@ -132,17 +191,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
132 | /// <param name="assetServer"></param> | 191 | /// <param name="assetServer"></param> |
133 | public AssetCache(IAssetServer assetServer) | 192 | public AssetCache(IAssetServer assetServer) |
134 | { | 193 | { |
135 | m_log.Info("[ASSET CACHE]: Creating Asset cache"); | 194 | m_log.Info("[ASSET CACHE]: Asset cache direct constructor"); |
136 | Initialize(); | 195 | Initialise(assetServer); |
137 | |||
138 | m_assetServer = assetServer; | ||
139 | m_assetServer.SetReceiver(this); | ||
140 | |||
141 | Thread assetCacheThread = new Thread(RunAssetManager); | ||
142 | assetCacheThread.Name = "AssetCacheThread"; | ||
143 | assetCacheThread.IsBackground = true; | ||
144 | assetCacheThread.Start(); | ||
145 | ThreadTracker.Add(assetCacheThread); | ||
146 | } | 196 | } |
147 | 197 | ||
148 | /// <summary> | 198 | /// <summary> |
@@ -342,7 +392,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
342 | } | 392 | } |
343 | 393 | ||
344 | // See IAssetReceiver | 394 | // See IAssetReceiver |
345 | public void AssetReceived(AssetBase asset, bool IsTexture) | 395 | public virtual void AssetReceived(AssetBase asset, bool IsTexture) |
346 | { | 396 | { |
347 | 397 | ||
348 | AssetInfo assetInf = new AssetInfo(asset); | 398 | AssetInfo assetInf = new AssetInfo(asset); |
@@ -393,7 +443,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
393 | } | 443 | } |
394 | 444 | ||
395 | // See IAssetReceiver | 445 | // See IAssetReceiver |
396 | public void AssetNotFound(UUID assetID, bool IsTexture) | 446 | public virtual void AssetNotFound(UUID assetID, bool IsTexture) |
397 | { | 447 | { |
398 | // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); | 448 | // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); |
399 | 449 | ||