Changeset 6945
- Timestamp:
- 11/02/11 18:42:44 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient/3.3/Program.cs
r6744 r6945 21 21 22 22 using System; 23 using System.Diagnostics; 23 24 using System.Threading; 24 25 … … 26 27 public class Program { 27 28 static void Main(string[] args) { 29 EventLog eventLog = null; 30 try { 31 if (!System.Diagnostics.EventLog.SourceExists("HLHive")) { 32 System.Diagnostics.EventLog.CreateEventSource("HLHive", "HiveSlave"); 33 } 34 eventLog = new EventLog(); 35 eventLog.Source = "HLHive"; 36 eventLog.Log = "HiveSlave"; 37 } 38 catch (Exception) { } 39 28 40 //slave part 29 41 Core core = new Core(); 42 core.ServiceEventLog = eventLog; 30 43 Console.WriteLine("Starting core ..."); 31 44 Thread coreThread = new Thread(core.Start); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.TrayIcon/3.3/HeuristicLab.Clients.Hive.Slave.TrayIcon-3.3.csproj
r6896 r6945 37 37 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> 38 38 <PlatformTarget>AnyCPU</PlatformTarget> 39 <OutputPath> ..\..\..\..\..\trunk\sources\bin\</OutputPath>39 <OutputPath>bin\Debug\</OutputPath> 40 40 </PropertyGroup> 41 41 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> … … 46 46 <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 47 47 <HintPath>..\..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 48 <Private> False</Private>48 <Private>True</Private> 49 49 </Reference> 50 50 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 51 51 <HintPath>..\..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 52 <Private> False</Private>52 <Private>True</Private> 53 53 </Reference> 54 54 <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 55 55 <HintPath>..\..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath> 56 <Private> False</Private>56 <Private>True</Private> 57 57 </Reference> 58 58 <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 59 59 <HintPath>..\..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath> 60 <Private> False</Private>60 <Private>True</Private> 61 61 </Reference> 62 62 <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 63 63 <HintPath>..\..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath> 64 <Private> False</Private>64 <Private>True</Private> 65 65 </Reference> 66 66 <Reference Include="System" /> … … 112 112 <Project>{8C0D9F39-397F-4DBE-856F-BC4DC0FE23F8}</Project> 113 113 <Name>HeuristicLab.Clients.Hive.Slave.Views-3.3</Name> 114 <Private> False</Private>114 <Private>True</Private> 115 115 </ProjectReference> 116 116 <ProjectReference Include="..\..\HeuristicLab.Clients.Hive.Slave\3.3\HeuristicLab.Clients.Hive.Slave-3.3.csproj"> 117 117 <Project>{989FE92B-484E-41EE-87E2-6A24AF0381D8}</Project> 118 118 <Name>HeuristicLab.Clients.Hive.Slave-3.3</Name> 119 <Private> False</Private>119 <Private>True</Private> 120 120 </ProjectReference> 121 121 </ItemGroup> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewBase.cs
r6823 r6945 61 61 #region Register Content Events 62 62 protected override void DeregisterContentEvents() { 63 Content.CoreConnectionChanged -= new EventHandler<Common.EventArgs<CoreConnection>>(Content_CoreConnectionChanged); 63 64 base.DeregisterContentEvents(); 64 65 } … … 66 67 protected override void RegisterContentEvents() { 67 68 base.RegisterContentEvents(); 69 Content.CoreConnectionChanged += new EventHandler<Common.EventArgs<CoreConnection>>(Content_CoreConnectionChanged); 70 } 71 72 void Content_CoreConnectionChanged(object sender, Common.EventArgs<CoreConnection> e) { 73 if (e.Value == CoreConnection.Offline) { 74 Connector(); 75 } 68 76 } 69 77 #endregion … … 77 85 Content.UserVisibleMessageFired += new System.EventHandler<Common.EventArgs<string>>(Content_UserVisibleMessageFired); 78 86 Task.Factory.StartNew(Connector); 87 } else { 88 Content.UserVisibleMessageFired -= new System.EventHandler<Common.EventArgs<string>>(Content_UserVisibleMessageFired); 79 89 } 80 90 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.WindowsService/3.3/ProjectInstaller.cs
r6898 r6945 15 15 base.OnAfterInstall(savedState); 16 16 17 //try to create an event log 18 try { 19 if (!System.Diagnostics.EventLog.SourceExists("HLHive")) { 20 System.Diagnostics.EventLog.CreateEventSource("HLHive", "HiveSlave"); 21 } 22 } 23 catch { } 24 17 25 //try to start the service after installation 18 26 using (var serviceController = new ServiceController(this.serviceInstaller1.ServiceName, Environment.MachineName)) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs
r6910 r6945 71 71 public void Start() { 72 72 abortRequested = false; 73 EventLogManager.ServiceEventLog = ServiceEventLog; 73 74 74 75 try { … … 90 91 catch (Exception ex) { 91 92 if (ServiceEventLog != null) { 92 try { 93 ServiceEventLog.WriteEntry(string.Format("Hive Slave threw exception: {0} with stack trace: {1}", ex.ToString(), ex.StackTrace), EventLogEntryType.Error); 94 } 95 catch (Exception) { } 93 EventLogManager.LogException(ex); 96 94 } else { 97 95 //try to log with clientCom. if this works the user sees at least a message, -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj
r6896 r6945 118 118 <Compile Include="ExecutorQueue.cs" /> 119 119 <Compile Include="IPluginProvider.cs" /> 120 <Compile Include="Manager\EventLogManager.cs" /> 120 121 <Compile Include="Manager\TaskManager.cs" /> 121 122 <Compile Include="Exceptions\OutOfCoresException.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveClientCom.cs
r6456 r6945 57 57 } 58 58 catch { 59 pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom")); 59 EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with config!"); 60 61 try { 62 pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom")); 63 } 64 catch { 65 EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with fixed addresse!"); 66 return; 67 } 60 68 } 69 pipeFactory.Faulted += new System.EventHandler(pipeFactory_Faulted); 61 70 62 71 ISlaveCommunication pipeProxy = pipeFactory.CreateChannel(); … … 64 73 } 65 74 75 void pipeFactory_Faulted(object sender, System.EventArgs e) { 76 EventLogManager.LogMessage("SlaveClientCom just faulted. Trying to repair it..."); 77 78 try { 79 pipeFactory.Faulted -= new System.EventHandler(pipeFactory_Faulted); 80 SetupClientCom(); 81 } 82 catch { } 83 } 84 66 85 public static void Close() { 67 if (pipeFactory.State != CommunicationState.Closed )86 if (pipeFactory.State != CommunicationState.Closed && pipeFactory.State != CommunicationState.Faulted) 68 87 pipeFactory.Close(); 69 88 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveCommunicationService.cs
r6371 r6945 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.ServiceModel; … … 54 55 55 56 public void LogMessage(string message) { 56 subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) { 57 if (((ICommunicationObject)callback).State == CommunicationState.Opened) { 58 callback.OnMessageLogged(message); 59 } else { 60 subscribers.Remove(callback); 61 } 62 }); 57 try { 58 subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) { 59 if (((ICommunicationObject)callback).State == CommunicationState.Opened) { 60 callback.OnMessageLogged(message); 61 } else { 62 subscribers.Remove(callback); 63 } 64 }); 65 } 66 catch (Exception ex) { 67 EventLogManager.LogException(ex); 68 } 63 69 } 64 70 65 71 public void StatusChanged(StatusCommons status) { 66 subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) { 67 if (((ICommunicationObject)callback).State == CommunicationState.Opened) { 68 callback.OnStatusChanged(status); 69 } else { 70 subscribers.Remove(callback); 71 } 72 }); 72 try { 73 subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) { 74 if (((ICommunicationObject)callback).State == CommunicationState.Opened) { 75 callback.OnStatusChanged(status); 76 } else { 77 subscribers.Remove(callback); 78 } 79 }); 80 } 81 catch (Exception ex) { 82 EventLogManager.LogException(ex); 83 } 73 84 } 74 85 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveTask.cs
r6725 r6945 51 51 52 52 public TimeSpan ExecutionTime { 53 get { return executor != null ? executor.ExecutionTime : TimeSpan.Zero; } 53 get { 54 try { 55 return executor != null ? executor.ExecutionTime : TimeSpan.Zero; 56 } 57 catch (Exception ex) { 58 EventLogManager.LogException(ex); 59 return TimeSpan.Zero; 60 } 61 } 54 62 } 55 63 … … 122 130 123 131 if (executor != null) { 124 executor.Dispose(); 132 try { 133 executor.Dispose(); 134 } 135 catch (Exception ex) { 136 EventLogManager.LogException(ex); 137 } 125 138 } 126 139 … … 155 168 156 169 public TaskData GetTaskData() { 157 return executor.GetTaskData(); 170 TaskData data = null; 171 try { 172 data = executor.GetTaskData(); 173 } 174 catch (Exception ex) { 175 EventLogManager.LogException(ex); 176 } 177 return data; 158 178 } 159 179
Note: See TracChangeset
for help on using the changeset viewer.