diff options
author | John Hurliman | 2009-10-23 14:22:21 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-23 14:22:21 -0700 |
commit | 2c34619aea074446e53dde80d397973075914bac (patch) | |
tree | 57dc6b70a33df038b334e8632caa084c02ded5ce /OpenSim | |
parent | * Change the way Util.FireAndForget() calls SmartThreadPool to avoid using a ... (diff) | |
download | opensim-SC-2c34619aea074446e53dde80d397973075914bac.zip opensim-SC-2c34619aea074446e53dde80d397973075914bac.tar.gz opensim-SC-2c34619aea074446e53dde80d397973075914bac.tar.bz2 opensim-SC-2c34619aea074446e53dde80d397973075914bac.tar.xz |
* Changed various modules to not initialize timers unless the module is initialized. Ideally, the timers would not initialize unless the module was actually enabled, but Melanie's work on configuring module loading from a config file should make that unnecessary
* Wrapped the Bitmap class used to generate the world map tile in a using statement to dispose of it after the JPEG2000 data is created
Diffstat (limited to '')
7 files changed, 41 insertions, 31 deletions
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs index 2d28b8c..a6b0396 100644 --- a/OpenSim/Client/MXP/MXPModule.cs +++ b/OpenSim/Client/MXP/MXPModule.cs | |||
@@ -52,10 +52,10 @@ namespace OpenSim.Client.MXP | |||
52 | 52 | ||
53 | private IConfigSource m_config; | 53 | private IConfigSource m_config; |
54 | private int m_port = 1253; | 54 | private int m_port = 1253; |
55 | private Timer m_ticker; | ||
55 | 56 | ||
56 | private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 57 | private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
57 | private readonly Timer m_ticker = new Timer(100); | 58 | private bool m_shutdown; |
58 | private bool m_shutdown = false; | ||
59 | 59 | ||
60 | public void Initialise(Scene scene, IConfigSource source) | 60 | public void Initialise(Scene scene, IConfigSource source) |
61 | { | 61 | { |
@@ -78,6 +78,7 @@ namespace OpenSim.Client.MXP | |||
78 | 78 | ||
79 | m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); | 79 | m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); |
80 | 80 | ||
81 | m_ticker = new Timer(100); | ||
81 | m_ticker.AutoReset = false; | 82 | m_ticker.AutoReset = false; |
82 | m_ticker.Elapsed += ticker_Elapsed; | 83 | m_ticker.Elapsed += ticker_Elapsed; |
83 | 84 | ||
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 113d5c8..9b0d7ea 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Timers; | ||
33 | using log4net; | 32 | using log4net; |
34 | using Nini.Config; | 33 | using Nini.Config; |
35 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 5fd8369..285d36a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | |||
@@ -98,27 +98,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
98 | } | 98 | } |
99 | terrainRenderer.Initialise(m_scene, m_config); | 99 | terrainRenderer.Initialise(m_scene, m_config); |
100 | 100 | ||
101 | Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize); | 101 | using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) |
102 | //long t = System.Environment.TickCount; | 102 | { |
103 | //for (int i = 0; i < 10; ++i) { | 103 | //long t = System.Environment.TickCount; |
104 | //for (int i = 0; i < 10; ++i) { | ||
104 | terrainRenderer.TerrainToBitmap(mapbmp); | 105 | terrainRenderer.TerrainToBitmap(mapbmp); |
105 | //} | 106 | //} |
106 | //t = System.Environment.TickCount - t; | 107 | //t = System.Environment.TickCount - t; |
107 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | 108 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); |
108 | 109 | ||
109 | 110 | ||
110 | if (drawPrimVolume) | 111 | if (drawPrimVolume) |
111 | { | 112 | { |
112 | DrawObjectVolume(m_scene, mapbmp); | 113 | DrawObjectVolume(m_scene, mapbmp); |
113 | } | 114 | } |
114 | 115 | ||
115 | try | 116 | try |
116 | { | 117 | { |
117 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); | 118 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); |
118 | } | 119 | } |
119 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | 120 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke |
120 | { | 121 | { |
121 | m_log.Error("Failed generating terrain map: " + e); | 122 | m_log.Error("Failed generating terrain map: " + e); |
123 | } | ||
122 | } | 124 | } |
123 | 125 | ||
124 | return imageData; | 126 | return imageData; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a3bc04b..47b13bd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -891,6 +891,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | { | 891 | { |
892 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); | 892 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); |
893 | 893 | ||
894 | m_restartTimer.Stop(); | ||
895 | m_restartTimer.Close(); | ||
896 | |||
894 | // Kick all ROOT agents with the message, 'The simulator is going down' | 897 | // Kick all ROOT agents with the message, 'The simulator is going down' |
895 | ForEachScenePresence(delegate(ScenePresence avatar) | 898 | ForEachScenePresence(delegate(ScenePresence avatar) |
896 | { | 899 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index b2544fa..f24869b 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
94 | } | 94 | } |
95 | private Dictionary<UUID, GroupRequestIDInfo> m_clientRequestIDInfo = new Dictionary<UUID, GroupRequestIDInfo>(); | 95 | private Dictionary<UUID, GroupRequestIDInfo> m_clientRequestIDInfo = new Dictionary<UUID, GroupRequestIDInfo>(); |
96 | private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes | 96 | private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes |
97 | private Timer m_clientRequestIDFlushTimer = new Timer(); | 97 | private Timer m_clientRequestIDFlushTimer; |
98 | 98 | ||
99 | 99 | ||
100 | // Configuration settings | 100 | // Configuration settings |
@@ -133,6 +133,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
133 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); | 133 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); |
134 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); | 134 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); |
135 | 135 | ||
136 | m_clientRequestIDFlushTimer = new Timer(); | ||
136 | m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; | 137 | m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; |
137 | m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; | 138 | m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; |
138 | m_clientRequestIDFlushTimer.AutoReset = true; | 139 | m_clientRequestIDFlushTimer.AutoReset = true; |
diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs index fc1c608..3490a8b 100644 --- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs | |||
@@ -45,13 +45,13 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
45 | public class SvnBackupModule : IRegionModule | 45 | public class SvnBackupModule : IRegionModule |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
49 | private readonly Timer m_timer = new Timer(); | ||
50 | 48 | ||
51 | private bool m_enabled = false; | 49 | private List<Scene> m_scenes; |
52 | private bool m_installBackupOnLoad = false; | 50 | private Timer m_timer; |
51 | private bool m_enabled; | ||
52 | private bool m_installBackupOnLoad; | ||
53 | private IRegionSerialiserModule m_serialiser; | 53 | private IRegionSerialiserModule m_serialiser; |
54 | private bool m_svnAutoSave = false; | 54 | private bool m_svnAutoSave; |
55 | private SvnClient m_svnClient; | 55 | private SvnClient m_svnClient; |
56 | private string m_svndir = "SVNmodule" + Slash.DirectorySeparatorChar + "repo"; | 56 | private string m_svndir = "SVNmodule" + Slash.DirectorySeparatorChar + "repo"; |
57 | private string m_svnpass = "password"; | 57 | private string m_svnpass = "password"; |
@@ -204,6 +204,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
204 | 204 | ||
205 | public void Initialise(Scene scene, IConfigSource source) | 205 | public void Initialise(Scene scene, IConfigSource source) |
206 | { | 206 | { |
207 | m_scenes = new List<Scene>(); | ||
208 | m_timer = new Timer(); | ||
209 | |||
207 | try | 210 | try |
208 | { | 211 | { |
209 | if (!source.Configs["SVN"].GetBoolean("Enabled", false)) | 212 | if (!source.Configs["SVN"].GetBoolean("Enabled", false)) |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 41a6255..ac39a53 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -41,12 +41,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
41 | { | 41 | { |
42 | // private const bool m_enabled = false; | 42 | // private const bool m_enabled = false; |
43 | 43 | ||
44 | private Mutex m_createMutex = new Mutex(false); | 44 | private Mutex m_createMutex; |
45 | 45 | private Timer m_timer; | |
46 | private Timer m_timer = new Timer(500); | ||
47 | 46 | ||
48 | private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); | 47 | private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); |
49 | |||
50 | private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>(); | 48 | private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>(); |
51 | 49 | ||
52 | // Timer vars. | 50 | // Timer vars. |
@@ -138,10 +136,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
138 | 136 | ||
139 | public void Initialise(Scene scene, IConfigSource source) | 137 | public void Initialise(Scene scene, IConfigSource source) |
140 | { | 138 | { |
141 | scene.RegisterModuleInterface<INPCModule>(this); | 139 | m_createMutex = new Mutex(false); |
142 | 140 | ||
141 | m_timer = new Timer(500); | ||
143 | m_timer.Elapsed += m_timer_Elapsed; | 142 | m_timer.Elapsed += m_timer_Elapsed; |
144 | m_timer.Start(); | 143 | m_timer.Start(); |
144 | |||
145 | scene.RegisterModuleInterface<INPCModule>(this); | ||
145 | } | 146 | } |
146 | 147 | ||
147 | void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) | 148 | void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) |