diff options
Diffstat (limited to 'OpenSim/Tools/OpenSim.GridLaunch/AppExecutor_Thread.cs')
-rw-r--r-- | OpenSim/Tools/OpenSim.GridLaunch/AppExecutor_Thread.cs | 187 |
1 files changed, 0 insertions, 187 deletions
diff --git a/OpenSim/Tools/OpenSim.GridLaunch/AppExecutor_Thread.cs b/OpenSim/Tools/OpenSim.GridLaunch/AppExecutor_Thread.cs deleted file mode 100644 index f395aa4..0000000 --- a/OpenSim/Tools/OpenSim.GridLaunch/AppExecutor_Thread.cs +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | //using System; | ||
28 | //using System.Collections; | ||
29 | //using System.Collections.Generic; | ||
30 | //using System.Reflection; | ||
31 | //using System.Text; | ||
32 | //using System.Threading; | ||
33 | //using log4net; | ||
34 | |||
35 | //namespace OpenSim.GridLaunch | ||
36 | //{ | ||
37 | // internal class AppExecutor2 | ||
38 | // { | ||
39 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | // private static readonly int consoleReadIntervalMilliseconds = 50; | ||
41 | // //private static readonly Timer readTimer = new Timer(readConsole, null, Timeout.Infinite, Timeout.Infinite); | ||
42 | // private static Thread timerThread; | ||
43 | // private static object timerThreadLock = new object(); | ||
44 | |||
45 | // #region Start / Stop timer thread | ||
46 | // private static void timer_Start() | ||
47 | // { | ||
48 | // //readTimer.Change(0, consoleReadIntervalMilliseconds); | ||
49 | // lock (timerThreadLock) | ||
50 | // { | ||
51 | // if (timerThread == null) | ||
52 | // { | ||
53 | // m_log.Debug("Starting timer thread."); | ||
54 | // timerThread = new Thread(timerThreadLoop); | ||
55 | // timerThread.Name = "StdOutputStdErrorReadThread"; | ||
56 | // timerThread.IsBackground = true; | ||
57 | // timerThread.Start(); | ||
58 | // } | ||
59 | // } | ||
60 | // } | ||
61 | // private static void timer_Stop() | ||
62 | // { | ||
63 | // //readTimer.Change(Timeout.Infinite, Timeout.Infinite); | ||
64 | // lock (timerThreadLock) | ||
65 | // { | ||
66 | // if (timerThread != null) | ||
67 | // { | ||
68 | // m_log.Debug("Stopping timer thread."); | ||
69 | // try | ||
70 | // { | ||
71 | // if (timerThread.IsAlive) | ||
72 | // timerThread.Abort(); | ||
73 | // timerThread.Join(2000); | ||
74 | // timerThread = null; | ||
75 | // } | ||
76 | // catch (Exception ex) | ||
77 | // { | ||
78 | // m_log.Error("Exception stopping timer thread: " + ex.ToString()); | ||
79 | // } | ||
80 | // } | ||
81 | // } | ||
82 | // } | ||
83 | // #endregion | ||
84 | |||
85 | // #region Timer read from consoles and fire event | ||
86 | |||
87 | // private static void timerThreadLoop() | ||
88 | // { | ||
89 | // try | ||
90 | // { | ||
91 | // while (true) | ||
92 | // { | ||
93 | // readConsole(); | ||
94 | // Thread.Sleep(consoleReadIntervalMilliseconds); | ||
95 | // } | ||
96 | // } | ||
97 | // catch (ThreadAbortException) { } // Expected on thread shutdown | ||
98 | // } | ||
99 | |||
100 | // private static void readConsole() | ||
101 | // { | ||
102 | // try | ||
103 | // { | ||
104 | |||
105 | // // Lock so we don't collide with any startup or shutdown | ||
106 | // lock (Program.AppList) | ||
107 | // { | ||
108 | // foreach (AppExecutor app in new ArrayList(Program.AppList.Values)) | ||
109 | // { | ||
110 | // try | ||
111 | // { | ||
112 | // string txt = app.GetStdOutput(); | ||
113 | // // Fire event with received text | ||
114 | // if (!string.IsNullOrEmpty(txt)) | ||
115 | // Program.FireAppConsoleOutput(app.File, txt); | ||
116 | // } | ||
117 | // catch (Exception ex) | ||
118 | // { | ||
119 | // m_log.ErrorFormat("Exception reading standard output from \"{0}\": {1}", app.File, ex.ToString()); | ||
120 | // } | ||
121 | // try | ||
122 | // { | ||
123 | // string txt = app.GetStdError(); | ||
124 | // // Fire event with received text | ||
125 | // if (!string.IsNullOrEmpty(txt)) | ||
126 | // Program.FireAppConsoleOutput(app.File, txt); | ||
127 | // } | ||
128 | // catch (Exception ex) | ||
129 | // { | ||
130 | // m_log.ErrorFormat("Exception reading standard error from \"{0}\": {1}", app.File, ex.ToString()); | ||
131 | // } | ||
132 | // } | ||
133 | // } | ||
134 | // } | ||
135 | // finally | ||
136 | // { | ||
137 | // } | ||
138 | // } | ||
139 | // #endregion | ||
140 | |||
141 | |||
142 | // #region Read stdOutput and stdError | ||
143 | // public string GetStdOutput() | ||
144 | // { | ||
145 | // return GetStreamData(Output); | ||
146 | // } | ||
147 | // public string GetStdError() | ||
148 | // { | ||
149 | // return GetStreamData(Error); | ||
150 | // } | ||
151 | |||
152 | // private static int num = 0; | ||
153 | // // Gets any data from StreamReader object, non-blocking | ||
154 | // private static string GetStreamData(StreamReader sr) | ||
155 | // { | ||
156 | // // Can't read? | ||
157 | // if (!sr.BaseStream.CanRead) | ||
158 | // return ""; | ||
159 | |||
160 | // // Read a chunk | ||
161 | // //sr.BaseStream.ReadTimeout = 100; | ||
162 | // byte[] buffer = new byte[4096]; | ||
163 | // num++; | ||
164 | // Trace.WriteLine("Start read " + num); | ||
165 | // int len = sr.BaseStream.Read(buffer, 0, buffer.Length); | ||
166 | // Trace.WriteLine("End read " + num + ": " + len); | ||
167 | |||
168 | // // Nothing? | ||
169 | // if (len <= 0) | ||
170 | // return ""; | ||
171 | |||
172 | // // Return data | ||
173 | // StringBuilder sb = new StringBuilder(); | ||
174 | // sb.Append(System.Text.Encoding.ASCII.GetString(buffer, 0, len)); | ||
175 | |||
176 | // //while (sr.Peek() >= 0) | ||
177 | // //{ | ||
178 | // // sb.Append(Convert.ToChar(sr.Read())); | ||
179 | // //} | ||
180 | |||
181 | // return sb.ToString(); | ||
182 | // } | ||
183 | // #endregion | ||
184 | |||
185 | |||
186 | // } | ||
187 | //} | ||