From 1fef45bc2ba7111f9fd8b89d71334b741940580a Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 14 Jun 2007 10:36:19 +0000 Subject: Commented out the Scene.Backup method for now as there isn't really anything to Backup yet and it might be the cause of a memory leak. Deleted EmbeddedJVM scripting engine, not being used. "If" we ever decide to use it then it can be re-added. --- .../OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs | 161 --------------------- 1 file changed, 161 deletions(-) delete mode 100644 OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs (limited to 'OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs') diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs deleted file mode 100644 index 2de8152..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs +++ /dev/null @@ -1,161 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Utilities; - -namespace OpenSim.Scripting.EmbeddedJVM -{ - public class OpenSimJVM : IScriptEngine - { - private List _threads = new List(); - private BlockingQueue CompileScripts = new BlockingQueue(); - private MainMemory _mainMemory; - private System.Threading.Thread compileThread; - - public OpenSimJVM() - { - - } - - public bool Init(IScriptAPI api) - { - Console.WriteLine("Creating OpenSim JVM scripting engine"); - _mainMemory = new MainMemory(); - Thread.GlobalMemory = this._mainMemory; - Thread.OpenSimScriptAPI = api; - compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); - compileThread.IsBackground = true; - compileThread.Start(); - return true; - } - - public string GetName() - { - return "OpenSimJVM"; - } - - public void LoadScript(string script, string scriptName, uint entityID) - { - Console.WriteLine("OpenSimJVM - loading new script: " + scriptName); - CompileInfo comp = new CompileInfo(); - comp.entityId = entityID; - comp.script = script; - comp.scriptName = scriptName; - this.CompileScripts.Enqueue(comp); - } - - public void CompileScript() - { - while (true) - { - CompileInfo comp = this.CompileScripts.Dequeue(); - string script = comp.script; - string scriptName = comp.scriptName; - uint entityID = comp.entityId; - try - { - //need to compile the script into a java class file - - //first save it to a java source file - TextWriter tw = new StreamWriter(scriptName + ".java"); - tw.WriteLine(script); - tw.Close(); - - //now compile - System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); - // psi.RedirectStandardOutput = true; - psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - psi.UseShellExecute = false; - - System.Diagnostics.Process javacomp; - javacomp = System.Diagnostics.Process.Start(psi); - javacomp.WaitForExit(); - - - //now load in class file - ClassRecord class1 = new ClassRecord(); - class1.LoadClassFromFile(scriptName + ".class"); - class1.PrintToConsole(); - //Console.WriteLine(); - this._mainMemory.MethodArea.Classes.Add(class1); - class1.AddMethodsToMemory(this._mainMemory.MethodArea); - - Thread newThread = new Thread(); - this._threads.Add(newThread); - newThread.EntityId = entityID; - newThread.currentClass = class1; - - //now delete the created files - System.IO.File.Delete(scriptName + ".java"); - System.IO.File.Delete(scriptName + ".class"); - //this.OnFrame(); - } - catch (Exception e) - { - Console.WriteLine("exception"); - Console.WriteLine(e.StackTrace); - Console.WriteLine(e.Message); - } - } - } - - public void OnFrame() - { - for (int i = 0; i < this._threads.Count; i++) - { - if (!this._threads[i].running) - { - this._threads[i].StartMethod("OnFrame"); - bool run = true; - while (run) - { - run = this._threads[i].Excute(); - } - } - } - } - - private class CompileInfo - { - public string script; - public string scriptName; - public uint entityId; - - public CompileInfo() - { - - } - } - } -} -- cgit v1.1