Changeset 932
- Timestamp:
- 12/10/08 11:15:47 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 added
- 3 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Common/HeuristicLab.Hive.Client.Common.csproj
r852 r932 68 68 <Compile Include="Logging.cs" /> 69 69 <Compile Include="MessageQueue.cs" /> 70 <Compile Include="NetworkEnum.cs" /> 70 71 <Compile Include="Properties\AssemblyInfo.cs" /> 71 <Compile Include="Status.cs" />72 72 </ItemGroup> 73 73 <ItemGroup> -
trunk/sources/HeuristicLab.Hive.Client.Communication/HeuristicLab.Hive.Client.Communication.csproj
r923 r932 70 70 <Compile Include="Properties\AssemblyInfo.cs" /> 71 71 <Compile Include="ServerProxy.cs" /> 72 <Compile Include="ServiceLocator.cs" />73 72 <Compile Include="WcfService.cs" /> 74 73 </ItemGroup> -
trunk/sources/HeuristicLab.Hive.Client.Communication/WcfService.cs
r924 r932 8 8 using HeuristicLab.Hive.Contracts.BusinessObjects; 9 9 using HeuristicLab.Hive.Client.Common; 10 11 10 12 11 namespace HeuristicLab.Hive.Client.Communication { … … 22 21 } 23 22 24 public enum ConnectionState { connected, disconnected, failed } 25 public ConnectionState ConnState { get; set; } 23 public DateTime ConnectedSince { get; private set; } 24 public NetworkEnum.WcfConnState ConnState { get; private set; } 25 public string ServerIP { get; private set; } 26 public int ServerPort { get; private set; } 26 27 27 28 public event EventHandler ConnectionRestored; 29 public event EventHandler ServerChanged; 28 30 29 31 private ClientCommunicatorClient proxy = null; 30 private string serverIP;31 private string serverPort;32 32 33 33 private WcfService() { … … 38 38 proxy = new ClientCommunicatorClient( 39 39 new NetTcpBinding(), 40 new EndpointAddress("net.tcp://" + serverIP + ":" + serverPort + "/HiveServer/ClientCommunicator")40 new EndpointAddress("net.tcp://" + ServerIP + ":" + ServerPort + "/HiveServer/ClientCommunicator") 41 41 ); 42 42 } … … 47 47 proxy.SendHeartBeatCompleted += new EventHandler<SendHeartBeatCompletedEventArgs>(proxy_SendHeartBeatCompleted); 48 48 49 if (ConnState == ConnectionState.failed)49 if (ConnState == NetworkEnum.WcfConnState.Failed) 50 50 ConnectionRestored(this, new EventArgs()); 51 ConnState = ConnectionState.connected;52 51 ConnState = NetworkEnum.WcfConnState.Connected; 52 ConnectedSince = DateTime.Now; 53 53 } 54 54 catch (Exception ex) { … … 57 57 } 58 58 59 public void Connect(String serverIP, String serverPort) { 60 this.serverIP = serverIP; 61 this.serverPort = serverPort; 59 public void Connect(String serverIP, int serverPort) { 60 if(!(this.ServerIP == serverIP) && !(this.ServerPort == ServerPort)) 61 ServerChanged(this, new EventArgs()); 62 this.ServerIP = serverIP; 63 this.ServerPort = serverPort; 62 64 Connect(); 63 65 } 64 66 67 public void Disconnect() { 68 ConnState = NetworkEnum.WcfConnState.Disconnected; 69 } 70 65 71 private void NetworkErrorHandling(Exception e) { 66 ConnState = ConnectionState.failed;72 ConnState = NetworkEnum.WcfConnState.Failed; 67 73 Logging.GetInstance().Error(this.ToString(), "exception: ", e); 68 74 } … … 71 77 public event System.EventHandler<LoginCompletedEventArgs> LoginCompleted; 72 78 public void LoginAsync(ClientInfo clientInfo) { 73 if (ConnState == ConnectionState.connected)79 if (ConnState == NetworkEnum.WcfConnState.Connected) 74 80 proxy.LoginAsync(clientInfo); 75 81 } … … 85 91 public event System.EventHandler<PullJobCompletedEventArgs> PullJobCompleted; 86 92 public void PullJobAsync(Guid guid) { 87 if (ConnState == ConnectionState.connected)93 if (ConnState == NetworkEnum.WcfConnState.Connected) 88 94 proxy.PullJobAsync(guid); 89 95 } … … 99 105 public event System.EventHandler<SendJobResultCompletedEventArgs> SendJobResultCompleted; 100 106 public void SendJobResultAsync(JobResult result, bool finished) { 101 if (ConnState == ConnectionState.connected)107 if (ConnState == NetworkEnum.WcfConnState.Connected) 102 108 proxy.SendJobResult(result, finished); 103 109 } … … 115 121 public event System.EventHandler<SendHeartBeatCompletedEventArgs> SendHeartBeatCompleted; 116 122 public void SendHeartBeatAsync(HeartBeatData hbd) { 117 if (ConnState == ConnectionState.connected)123 if (ConnState == NetworkEnum.WcfConnState.Connected) 118 124 proxy.SendHeartBeatAsync(hbd); 119 125 } … … 127 133 128 134 #endregion 135 129 136 } 130 137 } -
trunk/sources/HeuristicLab.Hive.Client.Core/ClientConsoleService/ClientConsoleCommunicator.cs
r919 r932 4 4 using System.Text; 5 5 using HeuristicLab.Hive.Client.Core.ClientConsoleService.Interfaces; 6 using HeuristicLab.Hive.Client.Core.ConfigurationManager; 7 using HeuristicLab.Hive.Client.Communication; 6 8 7 9 namespace HeuristicLab.Hive.Client.Core.ClientConsoleService { … … 10 12 11 13 public StatusCommons GetStatusInfos() { 12 throw new NotImplementedException();14 return ConfigManager.Instance.GetStatusForClientConsole(); 13 15 } 14 16 15 17 public ConnectionContainer GetConnection() { 16 throw new NotImplementedException();18 return new ConnectionContainer{IPAdress = WcfService.Instance.ServerIP, Port = WcfService.Instance.ServerPort } ; 17 19 } 18 20 19 21 public void SetConnection(ConnectionContainer container) { 20 throw new NotImplementedException(); 22 WcfService.Instance.Connect(container.IPAdress, container.Port); 23 } 24 25 public void Disconnect() { 26 WcfService.Instance.Disconnect(); 21 27 } 22 28 -
trunk/sources/HeuristicLab.Hive.Client.Core/ClientConsoleService/Interfaces/IClientConsoleCommunicator.cs
r919 r932 14 14 [OperationContract] 15 15 void SetConnection(ConnectionContainer container); 16 [OperationContract] 17 void Disconnect(); 16 18 } 17 19 } -
trunk/sources/HeuristicLab.Hive.Client.Core/ClientConsoleService/TransferObjects/StatusCommons.cs
r919 r932 3 3 using System.Linq; 4 4 using System.Text; 5 using HeuristicLab.Hive.Client.Common; 5 6 6 7 namespace HeuristicLab.Hive.Client.Core.ClientConsoleService { 7 8 [Serializable] 8 public class StatusCommons { 9 public enum ClientStatusEnum { Connected, Disconnected, ConnInterrupted }; 9 public class StatusCommons { 10 10 public Guid ClientGuid { get; set; } 11 public ClientStatusEnumStatus { get; set; }11 public NetworkEnum.WcfConnState Status { get; set; } 12 12 public DateTime ConnectedSince { get; set; } 13 13 public int JobsFetched { get; set; } -
trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
r924 r932 40 40 using System.ServiceModel.Description; 41 41 using HeuristicLab.Hive.Client.Core.ClientConsoleService; 42 using HeuristicLab.Hive.Client.Core.ConfigurationManager; 42 43 43 44 … … 57 58 server.StartClientConsoleServer(new Uri("net.tcp://127.0.0.1:8000/ClientConsole/")); 58 59 59 Config urationManager manager = ConfigurationManager.GetInstance();60 ConfigManager manager = ConfigManager.Instance; 60 61 manager.Core = this; 61 62 62 63 wcfService = WcfService.Instance; 63 wcfService.Connect("1 92.168.132.1", "9000");64 wcfService.Connect("10.20.53.1", 9000); 64 65 65 66 wcfService.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(wcfService_LoginCompleted); … … 67 68 wcfService.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(wcfService_SendJobResultCompleted); 68 69 wcfService.ConnectionRestored += new EventHandler(wcfService_ConnectionRestored); 70 wcfService.ServerChanged += new EventHandler(wcfService_ServerChanged); 69 71 70 wcfService.LoginAsync(Config urationManager.GetInstance().GetClientInfo());72 wcfService.LoginAsync(ConfigManager.Instance.GetClientInfo()); 71 73 72 74 Heartbeat beat = new Heartbeat { Interval = 10000 }; … … 115 117 byte[] sJob = engines[jId].GetFinishedJob(); 116 118 117 JobResult jobResult = new JobResult { JobId = jId, Result = sJob, Client = Config urationManager.GetInstance().GetClientInfo() };119 JobResult jobResult = new JobResult { JobId = jId, Result = sJob, Client = ConfigManager.Instance.GetClientInfo() }; 118 120 wcfService.SendJobResultAsync(jobResult, true); 119 121 } … … 135 137 if (e.Result.Success) { 136 138 Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now); 137 ConfigurationManager.GetInstance().Loggedin(); 138 Status.LoginTime = DateTime.Now; 139 Status.LoggedIn = true; 139 ConfigManager.Instance.Loggedin(); 140 140 } else 141 141 Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage); … … 156 156 engines.Add(e.Result.JobId, engine); 157 157 158 Status.CurrentJobs++;158 ClientStatusInfo.JobsFetched++; 159 159 160 Debug.WriteLine("Increment CurrentJobs to:"+Status.CurrentJobs.ToString());160 Debug.WriteLine("Increment FetchedJobs to:"+ClientStatusInfo.JobsFetched); 161 161 } 162 162 … … 166 166 appDomains.Remove(e.Result.JobId); 167 167 engines.Remove(e.Result.JobId); 168 Status.CurrentJobs--;169 Debug.WriteLine(" Decrement CurrentJobs to:" + Status.CurrentJobs.ToString());168 ClientStatusInfo.JobsProcessed++; 169 Debug.WriteLine("ProcessedJobs to:" + ClientStatusInfo.JobsProcessed); 170 170 } else { 171 171 Debug.WriteLine("Job sending FAILED!"); 172 172 } 173 173 } 174 175 void wcfService_ServerChanged(object sender, EventArgs e) { 176 foreach(KeyValuePair<long, AppDomain> entries in appDomains) 177 AppDomain.Unload(appDomains[entries.Key]); 178 appDomains = new Dictionary<long, AppDomain>(); 179 engines = new Dictionary<long, Executor>(); 180 } 181 174 182 175 183 #endregion -
trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs
r923 r932 74 74 freeMemory = 1000, 75 75 jobProgress = 1}; 76 if (wcfService.ConnState == WcfService.ConnectionState.failed) {76 if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) { 77 77 wcfService.Connect(); 78 } else if (wcfService.ConnState == WcfService.ConnectionState.connected) {78 } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Connected) { 79 79 wcfService.SendHeartBeatAsync(heartBeatData); 80 80 } -
trunk/sources/HeuristicLab.Hive.Client.Core/HeuristicLab.Hive.Client.Core.csproj
r919 r932 76 76 <Compile Include="ClientConsoleService\TransferObjects\JobStatus.cs" /> 77 77 <Compile Include="ClientConsoleService\TransferObjects\StatusCommons.cs" /> 78 <Compile Include="ConfigurationManager.cs" /> 78 <Compile Include="ConfigurationManager\ClientStatusInfo.cs" /> 79 <Compile Include="ConfigurationManager\ConfigManager.cs" /> 79 80 <Compile Include="Core.cs" /> 80 81 <Compile Include="CoreApplication.cs" />
Note: See TracChangeset
for help on using the changeset viewer.