aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-06 23:51:50 +0000
committerJustin Clark-Casey (justincc)2012-03-06 23:51:50 +0000
commit33769799233c144a4971efecf25afe1f6ab1d66f (patch)
tree41087824747ebe63a2d6079c88b6fd5d03f45f8d /OpenSim/Region
parentAdd sensor, dataserver requests, timer and listener counts to "xengine status... (diff)
downloadopensim-SC_OLD-33769799233c144a4971efecf25afe1f6ab1d66f.zip
opensim-SC_OLD-33769799233c144a4971efecf25afe1f6ab1d66f.tar.gz
opensim-SC_OLD-33769799233c144a4971efecf25afe1f6ab1d66f.tar.bz2
opensim-SC_OLD-33769799233c144a4971efecf25afe1f6ab1d66f.tar.xz
Remove static m_MainInstance in LocalGridServiceConnector.
I believe this was originally required back when there could be two LocalGridServiceConnectors but this is no longer the case. Having such statics makes performance testing much more difficult since they prevent GC of objects unless static references are explicitly nulled.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs34
1 files changed, 10 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 3c36799..4f0363a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -48,8 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
48 LogManager.GetLogger( 48 LogManager.GetLogger(
49 MethodBase.GetCurrentMethod().DeclaringType); 49 MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private static LocalGridServicesConnector m_MainInstance;
52
53 private IGridService m_GridService; 51 private IGridService m_GridService;
54 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); 52 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
55 53
@@ -62,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
62 public LocalGridServicesConnector(IConfigSource source) 60 public LocalGridServicesConnector(IConfigSource source)
63 { 61 {
64 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); 62 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
65 m_MainInstance = this;
66 InitialiseService(source); 63 InitialiseService(source);
67 } 64 }
68 65
@@ -87,7 +84,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
87 if (name == Name) 84 if (name == Name)
88 { 85 {
89 InitialiseService(source); 86 InitialiseService(source);
90 m_MainInstance = this;
91 m_Enabled = true; 87 m_Enabled = true;
92 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); 88 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled");
93 } 89 }
@@ -126,12 +122,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
126 122
127 public void PostInitialise() 123 public void PostInitialise()
128 { 124 {
129 if (m_MainInstance == this) 125 MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours",
130 { 126 "show neighbours",
131 MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", 127 "Shows the local regions' neighbours", NeighboursCommand);
132 "show neighbours",
133 "Shows the local regions' neighbours", NeighboursCommand);
134 }
135 } 128 }
136 129
137 public void Close() 130 public void Close()
@@ -143,22 +136,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
143 if (m_Enabled) 136 if (m_Enabled)
144 scene.RegisterModuleInterface<IGridService>(this); 137 scene.RegisterModuleInterface<IGridService>(this);
145 138
146 if (m_MainInstance == this) 139 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
147 { 140 m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
148 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) 141 else
149 m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); 142 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
150 else
151 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
152 }
153 } 143 }
154 144
155 public void RemoveRegion(Scene scene) 145 public void RemoveRegion(Scene scene)
156 { 146 {
157 if (m_MainInstance == this) 147 m_LocalCache[scene.RegionInfo.RegionID].Clear();
158 { 148 m_LocalCache.Remove(scene.RegionInfo.RegionID);
159 m_LocalCache[scene.RegionInfo.RegionID].Clear();
160 m_LocalCache.Remove(scene.RegionInfo.RegionID);
161 }
162 } 149 }
163 150
164 public void RegionLoaded(Scene scene) 151 public void RegionLoaded(Scene scene)
@@ -259,6 +246,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
259 246
260 MainConsole.Instance.Output(caps.ToString()); 247 MainConsole.Instance.Output(caps.ToString());
261 } 248 }
262
263 } 249 }
264} 250} \ No newline at end of file