Changeset 5280
- Timestamp:
- 01/11/11 17:29:40 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 13 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4/Program.cs
r5156 r5280 21 21 22 22 using System; 23 using System.ServiceModel;24 23 using System.Threading; 25 24 using HeuristicLab.Clients.Hive.Salve; … … 32 31 //mock the hive service for testing purposes 33 32 ServiceLocator.Instance = new MockServiceLocator(); 34 35 33 //slave part 36 34 Core core = new Core(); 37 ServiceHost slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 38 slaveComm.Open(); 35 Console.WriteLine("Starting core ..."); 36 Thread coreThread = new Thread(core.Start); 37 coreThread.IsBackground = true; //dont keep app alive 38 coreThread.Start(); 39 Thread.Sleep(1000); 39 40 40 Console.WriteLine("Slave communication service started ...");41 41 //mock a slave client 42 42 SlaveCommListener listener = new SlaveCommListener(); 43 43 listener.Open(); 44 44 45 Console.WriteLine("Starting core ...");46 Thread coreThread = new Thread(core.Start);47 coreThread.IsBackground = true; //dont keep app alive48 coreThread.Start();49 50 45 Console.WriteLine("Press a key to quit"); 51 46 Console.ReadKey(); 52 core.ShutdownCore();53 47 listener.Close(); 54 55 if (slaveComm.State != CommunicationState.Closed) 56 slaveComm.Close(); 48 core.Shutdown(); 49 Console.ReadKey(); 57 50 } 58 51 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4/app.config
r5156 r5280 3 3 4 4 <system.serviceModel> 5 <bindings> 6 <wsHttpBinding> 7 <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"> 8 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 9 <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/> 10 <security mode="Message"> 11 <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/> 12 <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"/> 13 </security> 14 </binding> 15 </wsHttpBinding> 16 </bindings> 17 5 18 <services> 6 19 <service name="HeuristicLab.Clients.Hive.Slave.SlaveCommunicationService"> … … 8 21 </service> 9 22 </services> 10 </system.serviceModel>11 23 24 <client> 25 <endpoint address="http://localhost:9000/Hive-3.4" 26 binding="wsHttpBinding" 27 bindingConfiguration="wsHttpBinding" 28 contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService" 29 name="wsHttpBinding_IHiveService"> 30 <identity> 31 <certificate encodedValue="AwAAAAEAAAAUAAAAfEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/> 32 </identity> 33 </endpoint> 34 </client> 35 36 </system.serviceModel> 12 37 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/SlaveCommListener.cs
r5158 r5280 44 44 45 45 public void Close() { 46 pipeProxy.Unsubscribe();47 if (pipeFactory.State != CommunicationState.Closed)46 if (pipeFactory.State != CommunicationState.Closed) { 47 pipeProxy.Unsubscribe(); 48 48 pipeFactory.Close(); 49 } 49 50 } 50 51 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r5158 r5280 24 24 using System.IO; 25 25 using System.Runtime.CompilerServices; 26 using System.ServiceModel; 26 27 using System.Threading; 27 28 using HeuristicLab.Clients.Hive.Slave; … … 39 40 public class Core : MarshalByRefObject { 40 41 public static bool abortRequested { get; set; } 42 private Semaphore waitShutdownSem = new Semaphore(0, 1); 41 43 public static ILog Log { get; set; } 42 44 … … 50 52 51 53 private ISlaveCommunication ClientCom; 54 private ServiceHost slaveComm; 52 55 53 56 public Dictionary<Guid, Executor> ExecutionEngines { … … 60 63 61 64 public Core() { 65 } 66 67 /// <summary> 68 /// Main Method for the client 69 /// </summary> 70 public void Start() { 62 71 coreThreadId = Thread.CurrentThread.ManagedThreadId; 63 }64 65 /// <summary>66 /// Main Method for the client67 /// </summary>68 public void Start() {69 72 abortRequested = false; 73 74 //start the client communication service (pipe between slave and slave gui) 75 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 76 slaveComm.Open(); 70 77 71 78 ClientCom = SlaveClientCom.Instance.ClientCom; … … 82 89 83 90 DeRegisterServiceEvents(); 91 waitShutdownSem.Release(); 84 92 } 85 93 … … 110 118 void wcfService_ExceptionOccured(object sender, EventArgs<Exception> e) { 111 119 ClientCom.LogMessage("Connection to server interruped with exception: " + e.Value.Message); 112 ShutdownCore();113 120 } 114 121 … … 159 166 } 160 167 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() { 162 175 ClientCom.LogMessage("Shutdown Signal received"); 163 176 ClientCom.LogMessage("Stopping heartbeat"); … … 165 178 abortRequested = true; 166 179 ClientCom.LogMessage("Logging out"); 180 167 181 168 182 lock (engines) { … … 177 191 ClientCom.Shutdown(); 178 192 SlaveClientCom.Close(); 193 194 if (slaveComm.State != CommunicationState.Closed) 195 slaveComm.Close(); 179 196 } 180 197 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/app.config
r5264 r5280 15 15 16 16 <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> 17 29 <services> 18 30 <service name="HeuristicLab.Clients.Hive.Slave.SlaveCommunicationService"> … … 20 32 </service> 21 33 </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> 22 41 </system.serviceModel> 23 42 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive 3.4.sln
r5264 r5280 57 57 EndProject 58 58 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4", "HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4\HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj", "{464D70B8-2D91-485C-B622-22E4A4891C68}" 59 EndProject 60 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave.SlaveWindowsService", "HeuristicLab.Clients.Hive.Slave.SlaveWindowsService\HeuristicLab.Clients.Hive.Slave.SlaveWindowsService.csproj", "{BA8001DE-E83C-4B1F-8B2E-2695C4222491}" 61 EndProject 62 Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "ServiceSetup", "ServiceSetup\ServiceSetup.vdproj", "{1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}" 59 63 EndProject 60 64 Global … … 193 197 {464D70B8-2D91-485C-B622-22E4A4891C68}.Release|x86.ActiveCfg = Release|x86 194 198 {464D70B8-2D91-485C-B622-22E4A4891C68}.Release|x86.Build.0 = Release|x86 199 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Debug|Any CPU.ActiveCfg = Debug|x86 200 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 201 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Debug|Mixed Platforms.Build.0 = Debug|x86 202 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Debug|x86.ActiveCfg = Debug|x86 203 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Debug|x86.Build.0 = Debug|x86 204 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Release|Any CPU.ActiveCfg = Release|x86 205 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Release|Mixed Platforms.ActiveCfg = Release|x86 206 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Release|Mixed Platforms.Build.0 = Release|x86 207 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Release|x86.ActiveCfg = Release|x86 208 {BA8001DE-E83C-4B1F-8B2E-2695C4222491}.Release|x86.Build.0 = Release|x86 209 {1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}.Debug|Any CPU.ActiveCfg = Debug 210 {1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}.Debug|Mixed Platforms.ActiveCfg = Debug 211 {1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}.Debug|x86.ActiveCfg = Debug 212 {1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}.Release|Any CPU.ActiveCfg = Release 213 {1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}.Release|Mixed Platforms.ActiveCfg = Release 214 {1F03CD3E-BE1B-4AF7-A378-8FECF5B7D9DA}.Release|x86.ActiveCfg = Release 195 215 EndGlobalSection 196 216 GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset
for help on using the changeset viewer.