Added a bool variable to OGS1GridServices to be able to turn off the use of the remoteRegionInfoCache as caching region data like that stops a dynamic grid (where regions could change port or host at any time, useful for load balancing among other things) from working.

The bool is currently hardcoded to be true (to use the cache). So need to hook this up to a config option later.
0.6.5-rc1
MW 2009-05-14 18:29:47 +00:00
parent b2433d2b99
commit 80c1c10407
1 changed files with 16 additions and 9 deletions

View File

@ -46,6 +46,7 @@ namespace OpenSim.Region.Communications.OGS1
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_useRemoteRegionCache = true;
/// <summary>
/// Encapsulate local backend services for manipulation of local regions
/// </summary>
@ -372,7 +373,7 @@ namespace OpenSim.Region.Communications.OGS1
}
regionInfo = buildRegionInfo(responseData, String.Empty);
if (requestData.ContainsKey("regionHandle"))
if ((m_useRemoteRegionCache) && (requestData.ContainsKey("regionHandle")))
{
m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo);
}
@ -394,7 +395,7 @@ namespace OpenSim.Region.Communications.OGS1
return regionInfo;
}
if (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo))
if((!m_useRemoteRegionCache) || (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)))
{
try
{
@ -437,6 +438,8 @@ namespace OpenSim.Region.Communications.OGS1
//IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI );
if (m_useRemoteRegionCache)
{
lock (m_remoteRegionInfoCache)
{
if (!m_remoteRegionInfoCache.ContainsKey(regionHandle))
@ -445,6 +448,7 @@ namespace OpenSim.Region.Communications.OGS1
}
}
}
}
catch (Exception e)
{
m_log.Error("[OGS1 GRID SERVICES]: " +
@ -480,12 +484,15 @@ namespace OpenSim.Region.Communications.OGS1
}
public RegionInfo RequestClosestRegion(string regionName)
{
if (m_useRemoteRegionCache)
{
foreach (RegionInfo ri in m_remoteRegionInfoCache.Values)
{
if (ri.RegionName == regionName)
return ri;
}
}
RegionInfo regionInfo = null;
try
@ -508,7 +515,7 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo = buildRegionInfo(responseData, "");
if (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle))
if ((m_useRemoteRegionCache) && (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle)))
m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo);
}
catch