Changeset 6989
- Timestamp:
- 11/14/11 16:25:18 (11 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs
r6983 r6989 53 53 private ConfigManager configManager; 54 54 private PluginManager pluginManager; 55 56 public Core() { 55 private bool startClientComService; 56 57 public Core() 58 : this(true) { 59 } 60 61 public Core(bool startClientComService) { 57 62 var log = new ThreadSafeLog(Settings.Default.MaxLogCount); 58 63 this.pluginManager = new PluginManager(WcfService.Instance, log); … … 64 69 this.configManager = new ConfigManager(taskManager); 65 70 ConfigManager.Instance = this.configManager; 71 72 this.startClientComService = startClientComService; 66 73 } 67 74 … … 74 81 75 82 try { 76 //start the client communication service (pipe between slave and slave gui) 77 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 78 slaveComm.Open(); 83 if (startClientComService) { 84 //start the client communication service (pipe between slave and slave gui) 85 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 86 slaveComm.Open(); 87 } 79 88 clientCom = SlaveClientCom.Instance.ClientCom; 80 89 … … 473 482 SlaveClientCom.Close(); 474 483 475 if (slaveComm.State != CommunicationState.Closed) 476 slaveComm.Close(); 484 if (startClientComService) { 485 if (slaveComm.State != CommunicationState.Closed) 486 slaveComm.Close(); 487 } 477 488 } 478 489 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj
r6983 r6989 128 128 <ItemGroup> 129 129 <Compile Include="Exceptions\TaskFailedException.cs" /> 130 <Compile Include="IClientCom.cs" /> 130 131 <Compile Include="Manager\ConfigManager.cs" /> 131 132 <Compile Include="Exceptions\SerializationException.cs" /> … … 142 143 <Compile Include="Exceptions\OutOfCoresException.cs" /> 143 144 <Compile Include="Exceptions\AppDomainNotCreatedException.cs" /> 145 <Compile Include="PipeCom.cs" /> 144 146 <Compile Include="SlaveClientCom.cs" /> 145 147 <Compile Include="Core.cs" /> … … 163 165 <Compile Include="SlaveStatusInfo.cs" /> 164 166 <Compile Include="StatusCommons.cs" /> 167 <Compile Include="TraceCom.cs" /> 165 168 <Compile Include="WcfService.cs" /> 166 169 <None Include="app.config" /> -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs
r6983 r6989 299 299 } 300 300 } 301 302 [global::System.Configuration.UserScopedSettingAttribute()] 303 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 304 [global::System.Configuration.DefaultSettingValueAttribute("Pipe")] 305 public global::HeuristicLab.Clients.Hive.SlaveCore.ClientComType ClientComType { 306 get { 307 return ((global::HeuristicLab.Clients.Hive.SlaveCore.ClientComType)(this["ClientComType"])); 308 } 309 set { 310 this["ClientComType"] = value; 311 } 312 } 301 313 } 302 314 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings
r6983 r6989 72 72 <Value Profile="(Default)">00:00:20</Value> 73 73 </Setting> 74 <Setting Name="ClientComType" Type="HeuristicLab.Clients.Hive.SlaveCore.ClientComType" Scope="User"> 75 <Value Profile="(Default)">Pipe</Value> 76 </Setting> 74 77 </Settings> 75 78 </SettingsFile> -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/SlaveClientCom.cs
r6983 r6989 20 20 #endregion 21 21 22 using System.ServiceModel; 22 using System; 23 using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts; 23 24 using HeuristicLab.Clients.Hive.SlaveCore.Properties; 24 using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts; 25 namespace HeuristicLab.Clients.Hive.SlaveCore { 25 26 26 namespace HeuristicLab.Clients.Hive.SlaveCore { 27 public enum ClientComType { Pipe, Trace }; 27 28 28 29 /// <summary> … … 31 32 public class SlaveClientCom { 32 33 private static SlaveClientCom instance; 33 private static DuplexChannelFactory<ISlaveCommunication> pipeFactory;34 private static IClientCom clientComInstance; 34 35 public ISlaveCommunication ClientCom { get; set; } 35 36 … … 47 48 } 48 49 49 private SlaveClientCom() { 50 SetupClientCom(); 50 public static IClientCom ClientComInstance { 51 get { 52 if (clientComInstance != null) { 53 return clientComInstance; 54 } 55 throw new NullReferenceException("No instance of SlaveClientCom<T>"); 56 } 51 57 } 52 58 53 private void SetupClientCom() { 54 DummyListener dummy = new DummyListener(); 55 try { 56 pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, Settings.Default.SlaveCommunicationServiceEndpoint); 59 private SlaveClientCom() { 60 ClientComType type = Settings.Default.ClientComType; 61 if (type == ClientComType.Pipe) { 62 clientComInstance = new PipeCom(); 63 } else if (type == ClientComType.Trace) { 64 clientComInstance = new TraceCom(); 65 } else { 66 throw new InvalidStateException("Invalid client communication type"); 57 67 } 58 catch {59 EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with config!");60 68 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 } 68 } 69 pipeFactory.Faulted += new System.EventHandler(pipeFactory_Faulted); 70 71 ISlaveCommunication pipeProxy = pipeFactory.CreateChannel(); 72 ClientCom = pipeProxy; 73 } 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 { } 69 ClientCom = clientComInstance.GetSlaveCom(); 83 70 } 84 71 85 72 public static void Close() { 86 if (pipeFactory.State != CommunicationState.Closed && pipeFactory.State != CommunicationState.Faulted) 87 pipeFactory.Close(); 73 ClientComInstance.Close(); 88 74 } 89 75 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/app.config
r6983 r6989 84 84 <value>00:00:20</value> 85 85 </setting> 86 <setting name="ClientComType" serializeAs="String"> 87 <value>Pipe</value> 88 </setting> 86 89 </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings> 87 90 </userSettings> … … 108 111 <client> 109 112 <endpoint name="SlaveCommunicationServiceEndpoint" address="net.pipe://localhost/HeuristicLabSlaveCom" binding="netNamedPipeBinding" contract="HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts.ISlaveCommunication"/> 110 <endpoint address="http:// services.heuristiclab.com/Hive-3.3/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Hive" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">113 <endpoint address="http://localhost/Hive-3.3/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Hive" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService"> 111 114 <identity> 112 <certificate encodedValue="AwAAAAEAAAAUAAAA wK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2j+FInEL5BuH6opDY6CSlrtt3xQS/anrhvpbf3QghLDVINzcHkzbPmm/SguG4F85QLB6xO+tJaOvRo0iEK5g3c307vMIru7FJwk/OhplEQ5J1hbDgL3zOJlrWlgtqRVxCtVdF3XroI9BctOt1NkeKv9ewIDAQABo1kwVzBVBgN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oint>
Note: See TracChangeset
for help on using the changeset viewer.