Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/11 17:29:40 (13 years ago)
Author:
ascheibe
Message:

#1233

  • added a new project: SlaveWindowsService: runs the Hive Slave as a Windows Service
  • some improvements when there is no server connection
  • some fixes for the communication between slave and gui
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs

    r5158 r5280  
    2424using System.IO;
    2525using System.Runtime.CompilerServices;
     26using System.ServiceModel;
    2627using System.Threading;
    2728using HeuristicLab.Clients.Hive.Slave;
     
    3940  public class Core : MarshalByRefObject {
    4041    public static bool abortRequested { get; set; }
     42    private Semaphore waitShutdownSem = new Semaphore(0, 1);
    4143    public static ILog Log { get; set; }
    4244
     
    5052
    5153    private ISlaveCommunication ClientCom;
     54    private ServiceHost slaveComm;
    5255
    5356    public Dictionary<Guid, Executor> ExecutionEngines {
     
    6063
    6164    public Core() {
     65    }
     66
     67    /// <summary>
     68    /// Main Method for the client
     69    /// </summary>
     70    public void Start() {
    6271      coreThreadId = Thread.CurrentThread.ManagedThreadId;
    63     }
    64 
    65     /// <summary>
    66     /// Main Method for the client
    67     /// </summary>
    68     public void Start() {
    6972      abortRequested = false;
     73
     74      //start the client communication service (pipe between slave and slave gui)
     75      slaveComm = new ServiceHost(typeof(SlaveCommunicationService));
     76      slaveComm.Open();
    7077
    7178      ClientCom = SlaveClientCom.Instance.ClientCom;
     
    8289
    8390      DeRegisterServiceEvents();
     91      waitShutdownSem.Release();
    8492    }
    8593
     
    110118    void wcfService_ExceptionOccured(object sender, EventArgs<Exception> e) {
    111119      ClientCom.LogMessage("Connection to server interruped with exception: " + e.Value.Message);
    112       ShutdownCore();
    113120    }
    114121
     
    159166    }
    160167
    161     public void ShutdownCore() {
     168    public void Shutdown() {
     169      MessageContainer mc = new MessageContainer(MessageContainer.MessageType.ShutdownSlave);
     170      MessageQueue.GetInstance().AddMessage(mc);
     171      waitShutdownSem.WaitOne();
     172    }
     173
     174    private void ShutdownCore() {
    162175      ClientCom.LogMessage("Shutdown Signal received");
    163176      ClientCom.LogMessage("Stopping heartbeat");
     
    165178      abortRequested = true;
    166179      ClientCom.LogMessage("Logging out");
     180
    167181
    168182      lock (engines) {
     
    177191      ClientCom.Shutdown();
    178192      SlaveClientCom.Close();
     193
     194      if (slaveComm.State != CommunicationState.Closed)
     195        slaveComm.Close();
    179196    }
    180197
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/app.config

    r5264 r5280  
    1515
    1616  <system.serviceModel>
     17    <bindings>
     18      <wsHttpBinding>
     19        <binding name="wsHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     20          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
     21          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     22          <security mode="Message">
     23            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
     24            <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"/>
     25          </security>
     26        </binding>
     27      </wsHttpBinding>
     28    </bindings>
    1729    <services>
    1830      <service name="HeuristicLab.Clients.Hive.Slave.SlaveCommunicationService">       
     
    2032      </service>
    2133    </services>
     34    <client>
     35      <endpoint address="http://localhost:9000/Hive-3.4" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService" name="wsHttpBinding_IHiveService">
     36        <identity>
     37          <certificate encodedValue="AwAAAAEAAAAUAAAAfEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/>
     38        </identity>
     39      </endpoint>
     40    </client>
    2241  </system.serviceModel>
    2342
Note: See TracChangeset for help on using the changeset viewer.