Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6989


Ignore:
Timestamp:
11/14/11 16:25:18 (12 years ago)
Author:
spimming
Message:

#1680:

  • start client communication service optionally
  • make slave client communication interchangeable ('PipeCom', 'TraceCom')
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  
    5353    private ConfigManager configManager;
    5454    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) {
    5762      var log = new ThreadSafeLog(Settings.Default.MaxLogCount);
    5863      this.pluginManager = new PluginManager(WcfService.Instance, log);
     
    6469      this.configManager = new ConfigManager(taskManager);
    6570      ConfigManager.Instance = this.configManager;
     71
     72      this.startClientComService = startClientComService;
    6673    }
    6774
     
    7481
    7582      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        }
    7988        clientCom = SlaveClientCom.Instance.ClientCom;
    8089
     
    473482      SlaveClientCom.Close();
    474483
    475       if (slaveComm.State != CommunicationState.Closed)
    476         slaveComm.Close();
     484      if (startClientComService) {
     485        if (slaveComm.State != CommunicationState.Closed)
     486          slaveComm.Close();
     487      }
    477488    }
    478489
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj

    r6983 r6989  
    128128  <ItemGroup>
    129129    <Compile Include="Exceptions\TaskFailedException.cs" />
     130    <Compile Include="IClientCom.cs" />
    130131    <Compile Include="Manager\ConfigManager.cs" />
    131132    <Compile Include="Exceptions\SerializationException.cs" />
     
    142143    <Compile Include="Exceptions\OutOfCoresException.cs" />
    143144    <Compile Include="Exceptions\AppDomainNotCreatedException.cs" />
     145    <Compile Include="PipeCom.cs" />
    144146    <Compile Include="SlaveClientCom.cs" />
    145147    <Compile Include="Core.cs" />
     
    163165    <Compile Include="SlaveStatusInfo.cs" />
    164166    <Compile Include="StatusCommons.cs" />
     167    <Compile Include="TraceCom.cs" />
    165168    <Compile Include="WcfService.cs" />
    166169    <None Include="app.config" />
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs

    r6983 r6989  
    299299            }
    300300        }
     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        }
    301313    }
    302314}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings

    r6983 r6989  
    7272      <Value Profile="(Default)">00:00:20</Value>
    7373    </Setting>
     74    <Setting Name="ClientComType" Type="HeuristicLab.Clients.Hive.SlaveCore.ClientComType" Scope="User">
     75      <Value Profile="(Default)">Pipe</Value>
     76    </Setting>
    7477  </Settings>
    7578</SettingsFile>
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/SlaveClientCom.cs

    r6983 r6989  
    2020#endregion
    2121
    22 using System.ServiceModel;
     22using System;
     23using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts;
    2324using HeuristicLab.Clients.Hive.SlaveCore.Properties;
    24 using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts;
     25namespace HeuristicLab.Clients.Hive.SlaveCore {
    2526
    26 namespace HeuristicLab.Clients.Hive.SlaveCore {
     27  public enum ClientComType { Pipe, Trace };
    2728
    2829  /// <summary>
     
    3132  public class SlaveClientCom {
    3233    private static SlaveClientCom instance;
    33     private static DuplexChannelFactory<ISlaveCommunication> pipeFactory;
     34    private static IClientCom clientComInstance;
    3435    public ISlaveCommunication ClientCom { get; set; }
    3536
     
    4748    }
    4849
    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      }
    5157    }
    5258
    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");
    5767      }
    58       catch {
    59         EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with config!");
    6068
    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();
    8370    }
    8471
    8572    public static void Close() {
    86       if (pipeFactory.State != CommunicationState.Closed && pipeFactory.State != CommunicationState.Faulted)
    87         pipeFactory.Close();
     73      ClientComInstance.Close();
    8874    }
    8975  }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave/3.3/app.config

    r6983 r6989  
    8484        <value>00:00:20</value>
    8585      </setting>
     86      <setting name="ClientComType" serializeAs="String">
     87        <value>Pipe</value>
     88      </setting>
    8689    </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings>
    8790  </userSettings>
     
    108111    <client>
    109112      <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">
    111114        <identity>
    112           <certificate encodedValue="AwAAAAEAAAAUAAAAwK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2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2uc4TOntXb5pgesS6vwd8assO8fmcT0D2IOJ+V4Q0H3Q8z3AqE9FoPrdj6/1CX+aQOSPwTWhs5AHRk6SvDLDaQtJPTNwldlyxmVTSZFq1wqLaRFCZ1U3furTOmHVOnIotIp+zm63bqs5U0=" />
    113116        </identity>
    114117      </endpoint>
Note: See TracChangeset for help on using the changeset viewer.