diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs')
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs index b1258f6..274932a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs | |||
@@ -27,15 +27,11 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Diagnostics; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Threading; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
36 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; |
38 | using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; | ||
39 | 35 | ||
40 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 36 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine |
41 | { | 37 | { |
@@ -45,14 +41,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
45 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | 41 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); |
46 | private MainMemory _mainMemory; | 42 | private MainMemory _mainMemory; |
47 | 43 | ||
48 | ScriptInfo scriptInfo; | 44 | private ScriptInfo scriptInfo; |
49 | 45 | ||
50 | public void Initialise(ScriptInfo info) | 46 | public void Initialise(ScriptInfo info) |
51 | { | 47 | { |
52 | scriptInfo = info; | 48 | scriptInfo = info; |
53 | 49 | ||
54 | _mainMemory = new MainMemory(); | 50 | _mainMemory = new MainMemory(); |
55 | Thread.GlobalMemory = this._mainMemory; | 51 | Thread.GlobalMemory = _mainMemory; |
56 | Thread.World = info.world; | 52 | Thread.World = info.world; |
57 | CompileScript(); | 53 | CompileScript(); |
58 | 54 | ||
@@ -60,33 +56,33 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
60 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | 56 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); |
61 | } | 57 | } |
62 | 58 | ||
63 | void events_OnNewPresence(ScenePresence presence) | 59 | private void events_OnNewPresence(ScenePresence presence) |
64 | { | 60 | { |
65 | for (int i = 0; i < this._threads.Count; i++) | 61 | for (int i = 0; i < _threads.Count; i++) |
66 | { | 62 | { |
67 | if (!this._threads[i].running) | 63 | if (!_threads[i].running) |
68 | { | 64 | { |
69 | this._threads[i].StartMethod("OnNewPresence"); | 65 | _threads[i].StartMethod("OnNewPresence"); |
70 | bool run = true; | 66 | bool run = true; |
71 | while (run) | 67 | while (run) |
72 | { | 68 | { |
73 | run = this._threads[i].Excute(); | 69 | run = _threads[i].Excute(); |
74 | } | 70 | } |
75 | } | 71 | } |
76 | } | 72 | } |
77 | } | 73 | } |
78 | 74 | ||
79 | void events_OnFrame() | 75 | private void events_OnFrame() |
80 | { | 76 | { |
81 | for (int i = 0; i < this._threads.Count; i++) | 77 | for (int i = 0; i < _threads.Count; i++) |
82 | { | 78 | { |
83 | if (!this._threads[i].running) | 79 | if (!_threads[i].running) |
84 | { | 80 | { |
85 | this._threads[i].StartMethod("OnFrame"); | 81 | _threads[i].StartMethod("OnFrame"); |
86 | bool run = true; | 82 | bool run = true; |
87 | while (run) | 83 | while (run) |
88 | { | 84 | { |
89 | run = this._threads[i].Excute(); | 85 | run = _threads[i].Excute(); |
90 | } | 86 | } |
91 | } | 87 | } |
92 | } | 88 | } |
@@ -103,12 +99,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
103 | CompileInfo comp = new CompileInfo(); | 99 | CompileInfo comp = new CompileInfo(); |
104 | comp.script = script; | 100 | comp.script = script; |
105 | comp.scriptName = script; | 101 | comp.scriptName = script; |
106 | this.CompileScripts.Enqueue(comp); | 102 | CompileScripts.Enqueue(comp); |
107 | } | 103 | } |
108 | 104 | ||
109 | public void CompileScript() | 105 | public void CompileScript() |
110 | { | 106 | { |
111 | CompileInfo comp = this.CompileScripts.Dequeue(); | 107 | CompileInfo comp = CompileScripts.Dequeue(); |
112 | string script = comp.script; | 108 | string script = comp.script; |
113 | string scriptName = comp.scriptName; | 109 | string scriptName = comp.scriptName; |
114 | try | 110 | try |
@@ -121,13 +117,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
121 | tw.Close(); | 117 | tw.Close(); |
122 | 118 | ||
123 | //now compile | 119 | //now compile |
124 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); | 120 | ProcessStartInfo psi = new ProcessStartInfo("javac.exe", "*.java"); |
125 | // psi.RedirectStandardOutput = true; | 121 | // psi.RedirectStandardOutput = true; |
126 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | 122 | psi.WindowStyle = ProcessWindowStyle.Hidden; |
127 | psi.UseShellExecute = false; | 123 | psi.UseShellExecute = false; |
128 | 124 | ||
129 | System.Diagnostics.Process javacomp; | 125 | Process javacomp; |
130 | javacomp = System.Diagnostics.Process.Start(psi); | 126 | javacomp = Process.Start(psi); |
131 | javacomp.WaitForExit(); | 127 | javacomp.WaitForExit(); |
132 | 128 | ||
133 | 129 | ||
@@ -136,17 +132,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
136 | class1.LoadClassFromFile(scriptName + ".class"); | 132 | class1.LoadClassFromFile(scriptName + ".class"); |
137 | class1.PrintToConsole(); | 133 | class1.PrintToConsole(); |
138 | //Console.WriteLine(); | 134 | //Console.WriteLine(); |
139 | this._mainMemory.MethodArea.Classes.Add(class1); | 135 | _mainMemory.MethodArea.Classes.Add(class1); |
140 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | 136 | class1.AddMethodsToMemory(_mainMemory.MethodArea); |
141 | 137 | ||
142 | Thread newThread = new Thread(); | 138 | Thread newThread = new Thread(); |
143 | this._threads.Add(newThread); | 139 | _threads.Add(newThread); |
144 | newThread.currentClass = class1; | 140 | newThread.currentClass = class1; |
145 | newThread.scriptInfo = scriptInfo; | 141 | newThread.scriptInfo = scriptInfo; |
146 | 142 | ||
147 | //now delete the created files | 143 | //now delete the created files |
148 | System.IO.File.Delete(scriptName + ".java"); | 144 | File.Delete(scriptName + ".java"); |
149 | System.IO.File.Delete(scriptName + ".class"); | 145 | File.Delete(scriptName + ".class"); |
150 | //this.OnFrame(); | 146 | //this.OnFrame(); |
151 | } | 147 | } |
152 | catch (Exception e) | 148 | catch (Exception e) |
@@ -164,8 +160,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
164 | 160 | ||
165 | public CompileInfo() | 161 | public CompileInfo() |
166 | { | 162 | { |
167 | |||
168 | } | 163 | } |
169 | } | 164 | } |
170 | } | 165 | } |
171 | } | 166 | } \ No newline at end of file |