Ignore:
Timestamp:
01/14/09 16:05:26 (12 years ago)
Author:
svonolfe
Message:

Added execution engine facade (#465)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server/HiveServerApplication.cs

    r1099 r1120  
    108108    }
    109109
     110    private ServiceHost StartExecutionEngineFacade(Uri uriTcp) {
     111      IExecutionEngineFacade[] serverConsoleInstances =
     112        discService.GetInstances<IExecutionEngineFacade>();
     113
     114      if (serverConsoleInstances.Length > 0) {
     115        ServiceHost serviceHost =
     116            new ServiceHost(serverConsoleInstances[0].GetType(),
     117                  uriTcp);
     118
     119        System.ServiceModel.Channels.Binding binding =
     120          new NetTcpBinding();
     121
     122        serviceHost.AddServiceEndpoint(
     123          typeof(IExecutionEngineFacade),
     124            binding,
     125            "ExecutionEngineFacade");
     126
     127        AddMexEndpoint(serviceHost);
     128
     129        serviceHost.Open();
     130
     131        return serviceHost;
     132      } else
     133        return null;
     134    }
     135
    110136    public override void Run() {
    111137      IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());
     
    129155        StartServerConsoleFacade(uriTcp);
    130156
     157      uriTcp =
     158        new Uri("net.tcp://" + addresses[index] + ":" + port + "/ExecutionEngine/");
     159
     160      ServiceHost executionEngineFacade =
     161        StartExecutionEngineFacade(uriTcp);
     162
    131163      ILifecycleManager[] lifecycleManagers =
    132164         discService.GetInstances<ILifecycleManager>();
     
    142174
    143175        Form mainForm = new MainForm(clientCommunicator.BaseAddresses[0],
    144             serverConsoleFacade.BaseAddresses[0]);
     176            serverConsoleFacade.BaseAddresses[0],
     177            executionEngineFacade.BaseAddresses[0]);
    145178
    146179         Application.Run(mainForm);
     
    151184      clientCommunicator.Close();
    152185      serverConsoleFacade.Close();
    153 
    154      
     186      executionEngineFacade.Close();     
    155187    }
    156188  }
Note: See TracChangeset for help on using the changeset viewer.